I need to have a hosted feature layer view be defined to show only the features from the previous day. This is not the past 24 hours, but for the entirety of the previous day. I was expecting to be able to update the viewDefinitionQuery using updateDefinition function in the REST admin. However, I cannot use the EXTRACT date function in the definition query. It appears that on the CURRENT_TIMESTAMP function is supported by views. It works in the where clause when doing a query on the feature layer, however when set as the viewDefinitionQuery on the view, the query on the view returns a 400 error:
{"error":{"code":400,"message":"Cannot perform query. Invalid query parameters.","details":["Unable to perform query. Please check your parameters."]}}
The query I am attempting is:
EXTRACT(YEAR from Reported_Date) = EXTRACT(YEAR from CURRENT_TIMESTAMP -1) and EXTRACT(MONTH from Reported_Date) = EXTRACT(MONTH from CURRENT_TIMESTAMP -1) and EXTRACT(DAY from Reported_Date) = EXTRACT(DAY from CURRENT_TIMESTAMP -1)
I just came across something similar.
We were using the following as part of query against an ArcGIS Server feature service for a few years
EXTRACT(HOUR FROM ACCIDENTDATE) > '6'
We moved that service to a hosted service in AGO and that query no longer worked. We got the same error message as Justin above.
Removing the apostrophes and adding &sqlFormat=standard to the querystring made it work. Not exactly sure why though.