Skip to main content
Question

First time using FeatureReader and WHERE clause

  • January 12, 2025
  • 2 replies
  • 30 views

epro_admin
Contributor
Forum|alt.badge.img+7

This is my first time using the FeatureReader and the WHERE clause. I’m trying to tidy up my workspace and make it a bit more efficient.

In the workspace I want to read in all the track points from an ArcGIS Online feature class and then in the WHERE clause filter it to just the last 24 hours.

This is the WHERE clause I’m using. It has the correct date field. I’ve formatted it in the DateTimeConverter like this %Y-%m-%d %H:%M:%S.

"location_timestamp">='@Value(_24hrsago)'

It filters immediately (I think) to what I need (first screenshot), but by the end it has passed through all the points in the feature set. Do I have the wrong output port connected up? Is there something I need to select in the parameters?

 

This is what the FeatureReader Parameters look like.

 

An additional question I have is if I want to filter to the last 24 hrs (as mentioned above) plus Projects A, B and C. How would I combine this in a SQL expression? I currently have this going into a Tester and then Clipper, but would like to refine the process. Would it look like "location_timestamp">='@Value(_24hrsago)' AND PROJECT_FIELD IN A,B,C? Do I need any “ or ‘s?

I wasn’t sure if I’ve posted this in the right spot in the community. Please let me know if I should post it somewhere else in the future. Thanks in advance for any help.

2 replies

bwn
Evangelist
Forum|alt.badge.img+26
  • Evangelist
  • January 13, 2025

Dates/Times are often difficult to figure out query syntax due to data systems not using a common storage format and API, even amongst different ESRI formats.

 

For ArcGIS online, where the data type is esriFieldTypeDate then it appears that the user needs to convert the date/time string to an ESRI date/time encoded value via either the DATE or TIMESTAMP function as the API will not do an automatic recast for you.

Try instead
"location_timestamp" >= TIMESTAMP '@Value(_24hrsago)'

 

For AND PROJECT_FIELD conditions, normally the syntax would be
AND “PROJECT_FIELD” IN (‘A’,’B’,’C’) but would required some experimentation as ESRI doesn’t seem to document what support for IN() it provides, if any.

Otherwise becomes AND (PROJECT_FIELD” = ‘A’ OR PROJECT_FIELD” = ‘B’ … )

 


epro_admin
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • January 13, 2025

Hi ​@bwn, Thanks for your reply. This is how I have the transformers set up leading up to the FeatureReader.

I think I address your second paragraph in the DateTimeConverter.

Now that you have that context (sorry I should have put that in the original post) do I still want the TIMESTAMP part in the WHERE clause. I added it in, and it still outputs all the features.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings