Feature Reader from Esri FGDB with a where clause based on a last_updated (date/time) field
Using an Esri FGDB Reader (an Esri FGDB FeatureReader) in a Workbench, I would like to apply a where clause using the last_updated field. I believe that because this is a date/time field that it is causing me troubles as I am able to run tests on other fields.
What is the correct syntax to enter a where clause on a date/time field from a FGDB?
Page 1 / 1
It’s a SQL query, but it has its own syntax, seems esri doesn’t implicitly convert strings to dates like other products do... I checked how ArcPro creates a definition query on a date. It should look like:
last_updated > timestamp '2023-03-15 12:00:00'
Just found this post - I have a similar scenario (and the solution works for me) but through the FeatureReader I want to find records based on a date compared to another date coming from an attribute. So I want to find records from FC A where FC A publish_date is greater than FC B last_run_time. I’ve tried a few different syntax ways and I feel it should be simple, but I keep getting the error “The error message from ArcObjects is: {An invalid SQL statement was used.}”. I feel like it’s a last_run_time formatting thing and taking @Value(LAST_RUN_TIME) isn’t correct. This is what’s not working..
“publish_date > timestamp(@Value(LAST_RUN_TIME))
Thoughts?
Maybe not the best to comment on my own question, but I figured this out. It was indeed the syntax being fed into the FeatureReader, so I used a StringConcatenator ahead of it to build the correct syntax and create a new attribute to compare to “publish_date”.
Then used the new attribute in the FeatureReader to compare to “publish_date” (I want every record with “publish_date” more recent than “last_update_time” (now “formatted_”)).
I’ve gone down the same solution as you have, creating an attribute that has the value timestamp plus the date enclosed in single quotes, I’m not sure if it should be possible directly in the writer