AnsweredAssumed Answered

Updating Host Feature Layer View viewDefinitionQuery using the REST admin

Question asked by jgreco on Sep 15, 2017
Latest reply on May 11, 2018 by matt2222

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) 

Outcomes