AnsweredAssumed Answered

Table out_statistics query doesn't work using ArcGIS API for Python

Question asked by mjimenez@prvectorcontrol.org_prvectorcontrol on Mar 5, 2018
Latest reply on Mar 5, 2018 by mjimenez@prvectorcontrol.org_prvectorcontrol

Hi, I'm using ArcGIS API for Python for querying a table using the following parameters:

 

query = maintenance.query(where='1=1', out_fields='structureid,last_maintenace', return_geometry=False, group_by_fields_for_statistics='structureid', out_statistics='[{"statisticType": "max","onStatisticField": "maintanancedate", "outStatisticFieldName": "last_maintenace"}]')

 

I'm always getting a error when trying to use the out_statistics parameter and there is no documentation for the syntax for this parameters. I'm assuming that it's the same syntax as the REST API where it work.

 

Help please!

 

Here is the complete code:

 

from arcgis import *
gis = GIS("http://...", "user", "password")

 

item = gis.content.get('123...')
maintenance = item.tables[0]
deployment = item.layers[0]

 

query = maintenance.query(where='1=1', out_fields='structureid,last_maintenace', return_geometry=False, group_by_fields_for_statistics='structureid', out_statistics='[{"statisticType": "max","onStatisticField": "maintanancedate", "outStatisticFieldName": "last_maintenace"}]')

Outcomes