Skip to main content
Best Answer

WHERE Clause for ArcGIS Online

  • March 9, 2020
  • 5 replies
  • 302 views

Hi All,

I have a point feature service on AGOL which gets populated daily with new points, data and attachments.

I'm trying to make a WHERE clause for an AGOL reader so FME only reads data from the last 3 days. According to ArcGIS dev page https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm , the WHERE clause should look like this EditDate > CURRENT_TIMESTAMP - INTERVAL '03' DAY

 

.

However, FME gives me a fatal error.

Simple queries like EditDate > '2020-03-05 00:00:00.000' work just fine.

EditDate is esriFieldTypeDate and it comes into FME as '20200305235154.156000'

 

P.S. the script will be published to FME Server (Cloud), so the solution should work for the Server too.

 

Please help!

 

Best answer by aandronov

@bruceharold @ebygomm

Just found a solution! WHERE Clause should look like

EditDate > DateAdd(day,-3,getdate())

 

Yay!

 

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.

5 replies

ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • March 9, 2020

I'm not familiar with how the query should be structured, but as an alternative you could swap the reader for a featurereader and ahead of this calculate the date 3 days ago to use in a simple where clause


bruceharold
Supporter
Forum|alt.badge.img+19
  • Supporter
  • March 9, 2020

I'm not familiar with how the query should be structured, but as an alternative you could swap the reader for a featurereader and ahead of this calculate the date 3 days ago to use in a simple where clause

I agree with @ebygomm I do this, figure out an expression for the where clause, works well.


  • Author
  • March 9, 2020

I'm not familiar with how the query should be structured, but as an alternative you could swap the reader for a featurereader and ahead of this calculate the date 3 days ago to use in a simple where clause

Thank you guys! This approach works fine for querying data from 3 last days; however, I struggle to find a way to read attachments from AGOL feature service using FeatureReader. Is there a way?

 

P.S. With a generic reader, I used AttributeExposer -> ListExploder to retrieve attachments. These 2 transformers don't do any good for the FeatureReader.


  • Author
  • Best Answer
  • March 11, 2020

@bruceharold @ebygomm

Just found a solution! WHERE Clause should look like

EditDate > DateAdd(day,-3,getdate())

 

Yay!

 


Forum|alt.badge.img+1
  • January 12, 2021

Thank you guys! This approach works fine for querying data from 3 last days; however, I struggle to find a way to read attachments from AGOL feature service using FeatureReader. Is there a way?

 

P.S. With a generic reader, I used AttributeExposer -> ListExploder to retrieve attachments. These 2 transformers don't do any good for the FeatureReader.

Don't know if you have solved this yet... but I was stumped on this too!

Screenshot 2021-01-12 154438Attribute File Writer Properties:

Screenshot 2021-01-12 154504Feature Reader Properties:

Screenshot 2021-01-12 154524