Skip to main content
Solved

WHERE clause in Reader

  • March 5, 2024
  • 2 replies
  • 274 views

marta.podsiad
Supporter
Forum|alt.badge.img+9

Hi,

I'm attempting to filter the records in the reader using the WHERE Clause, but I'm having trouble making it work. I'm trying to select all entries created after 20230718. I've tried the following equations, but it failed.

"created_date">20230718000000.000000

"created_date" LIKE '20231718%'

 

Error 

ArcGIS Portal Feature Service Reader: Encountered an unexpected error. The error code from the server was '500' and the message was: 'Invalid data type for expression ["created_date">20230718000000.000000].'. Details: ''

 

ArcGIS Portal Feature Service Reader: Encountered an unexpected error. The error code from the server was '500' and the message was: 'Invalid data type for expression ["created_date" LIKE '20230718%'].'. Details: ''

Best answer by nielsgerrits

What I would try is to get the query right in the arcgis rest endpoint first and then move it to workbench.

ESRI’s documentation is not very clear on how to do this, but the following blog discusses this topic:

https://www.esri.com/arcgis-blog/products/api-rest/data-management/querying-feature-services-date-time-queries/

I have not tested this, but the syntax should be

<DateField> = DATE 'YYYY-MM-DD'

<DateField> = TIMESTAMP 'YYYY-MM-DD HH:MI:SS'

So something like

created_date > DATE '2023-07-18'

should work.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

david_r
Celebrity
  • March 5, 2024

You cannot use the FME datetime format with ArcGIS Portal, try one of the supported formats described here: https://enterprise.arcgis.com/en/portal/latest/use/work-with-date-fields.htm


nielsgerrits
VIP
Forum|alt.badge.img+62
  • Best Answer
  • March 5, 2024

What I would try is to get the query right in the arcgis rest endpoint first and then move it to workbench.

ESRI’s documentation is not very clear on how to do this, but the following blog discusses this topic:

https://www.esri.com/arcgis-blog/products/api-rest/data-management/querying-feature-services-date-time-queries/

I have not tested this, but the syntax should be

<DateField> = DATE 'YYYY-MM-DD'

<DateField> = TIMESTAMP 'YYYY-MM-DD HH:MI:SS'

So something like

created_date > DATE '2023-07-18'

should work.