ArcGIS Runtime SDK for iOS

Statistical query (group and sort)

Description

This sample demonstrates how to query a feature table to get statistics for one or more specified fields. The sample queries a service feature table of U.S. county diabetes data to get the selected statistics. The results can be grouped and sorted using one or more fields in the table.

How it works

An AGSServiceFeatureTable is created with a URL to the REST endpoint of a feature service. AGSStatisticsQueryParameters are created, and several AGSStatisticDefinition objects are created and added to the parameters. These definitions defines the various statistics that we would like to compute, such as average, minimum and maximum of a given field. One or more Group By and/or Order By fields are added to the parameters. When the button is clicked, queryStatistics is executed on the AGSServiceFeatureTable. Depending on the state of two switches, additional parameters are set. This process runs asynchronously, and once completed, returns AGSStatisticsQueryResult, which contains key/value pairs as the result.


In this topic
  1. Description