Skip to main content
Solved

REST API: using a DateTimeValue in a $filter for a Generic Inquiry Web Service Endpoint

  • 1 June 2024
  • 4 replies
  • 93 views

I’m able to filter on any string mapped field but when I filter on a DateTimeValue mapped field, I get this error:

"exceptionMessage": "A binary operator with incompatible types was detected. Found operand types 'Edm.DateTimeOffset' and 'Edm.String' for operator kind 'Equal'."

 

Question: is there a specific way to filter on a datetime field?

 

Here’s the URL I’m using in Postman:

https://sandbox.com/entity/INStockItem/22.200.001/POReceiptPackages?$filter=POReceiptLine_lastModifiedDateTime eq '2022-08-30T18:39:55.813+00:00'

4 replies

Userlevel 7
Badge +19

@bpgraves  Please use like below 

 

{URL}}/entity/20.200.001/PurchaseOrder?$filter=LastModifiedDateTime ge datetimeoffset'2014-04-15' and LastModifiedDateTime le datetimeoffset'2022-04-29'

 

Here is the link for your reference 

https://stackoverflow.com/questions/65589385/acumatica-rest-api-filter-on-last-modified-date

Userlevel 3
Badge +1

@bpgraves  Please use like below 

 

{URL}}/entity/20.200.001/PurchaseOrder?$filter=LastModifiedDateTime ge datetimeoffset'2014-04-15' and LastModifiedDateTime le datetimeoffset'2022-04-29'

 

Here is the link for your reference 

https://stackoverflow.com/questions/65589385/acumatica-rest-api-filter-on-last-modified-date

This works fine for no-Generic Inquires using the Default entity.  However, my question was for Generic Inquires like this (POReceiptPackages is my Generic Inquiry name):

https://sandbox.com/entity/INStockItem/22.200.001/POReceiptPackages?$filter=POReceiptLine_lastModifiedDateTime ge datetimeoffset'2024-06-03'

 

I receive this error back:

    "exceptionMessage": "Optimization cannot be performed.The following fields cause the error:\r\nCarrier: View Results has BQL delegate\r\nQty: View Results has BQL delegate\r\nServices: View Results has BQL delegate\r\nTrackingNumber: View Results has BQL delegate\r\nInventoryID: View Results has BQL delegate\r\nPOReceiptLine_lastModifiedDateTime: View Results has BQL delegate\r\nPOOrderNbr: View Results has BQL delegate\r\nReceiptNbr: View Results has BQL delegate\r\n"

I receive this error back:

    "exceptionMessage": "Optimization cannot be performed.The following fields cause the error:\r\nCarrier: View Results has BQL delegate\r\nQty: View Results has BQL delegate\r\nServices: View Results has BQL delegate\r\nTrackingNumber: View Results has BQL delegate\r\nInventoryID: View Results has BQL delegate\r\nPOReceiptLine_lastModifiedDateTime: View Results has BQL delegate\r\nPOOrderNbr: View Results has BQL delegate\r\nReceiptNbr: View Results has BQL delegate\r\n"

 

Change to PUT command. 

Userlevel 7
Badge +4

This works fine for no-Generic Inquires using the Default entity.  However, my question was for Generic Inquires like this (POReceiptPackages is my Generic Inquiry name):

https://sandbox.com/entity/INStockItem/22.200.001/POReceiptPackages?$filter=POReceiptLine_lastModifiedDateTime ge datetimeoffset'2024-06-03'

GIs should use standard oData filters. Have you tried datetime’2024-06-03’

OData: Date "Greater Than" filter - Stack Overflow

Solved: Filter by DateTime in Odata - Microsoft Fabric Community

Reply