Definition Queries in Feature Service error in Collector

3243
3
08-19-2014 12:35 AM
SappiGIS
New Contributor III

Good day

 

I have a feature service with a date query in the map project to show only the points captured in the last 7 days [DATE > DATEADD(day,-7,SYSDATETIME())].  I publish the feature service in AGOL to use in collector in the disconnected mode. When downloading it in Collector I get the error: "The map 'abc' failed to download with the message: Failed to create Replica."

 

If I go back to the service and remove the definition Query and publish it again through AGOL.  I can download the service without any problem.  Can anybody assist with this issue.

 

Kind regards

Pieter

0 Kudos
3 Replies
OwenEarley
Regular Contributor

Just a thought - the definition query may be specific to SQL Server due to the SYSDATETIME() function. This would work when viewing data online but the SYSDATETIME() function may not be available in database that the Collector app uses locally on a device.

0 Kudos
SappiGIS
New Contributor III

Thank you for the quick response.  It make sense to me that the sysdatetime function will not be available on the collector.  Do you know of a way to get around this problem? I there a query available in ArcGIS that will do the same as the SQL Server Query?

0 Kudos
OwenEarley
Regular Contributor

I haven't really worked with collector. If you have control over the data you could run a scheduled process each night that calculates a new AgeInDays (long) field. This way your definition query is against a simple number value.

Something like:

date-diff.png

Seems to be a lot of pain for a simple task but it should work.