Query a feature table for statistics, grouping and sorting by different fields.
Use the buttons to add statistic definitions, define group and order by fields, and execute the query.
- Create a
ServiceFeatureTable
using the URL of a feature service and load the table. - Get the feature tables field names list with
featureTable.Fields
. - Create
StatisticDefinition
s specifying the field to compute statistics on and theStatisticType
to compute. - Create
StatisticsQueryParameters
passing in the list of statistic definitions. - To have the results grouped by fields, add the field names to the query parameters'
GroupByFieldNames
collection. - To have the results ordered by fields, create
OrderBy
s, specifying the field name andSortOrder
. Pass theseOrderBy
s to the parameters'OrderByFields
collection. - To execute the query, call
featureTable.QueryStatisticsAsync(queryParameters)
. - Get the
StatisticQueryResult
. From this, you can get an iterator ofStatisticRecord
s to loop through and display.
- Field
- QueryParameters
- ServiceFeatureTable
- StatisticDefinition
- StatisticRecord
- StatisticType
- StatisticsQueryParameters
- StatisticsQueryResult
This sample uses a Diabetes, Obesity, and Inactivity by US County feature layer.
group, result, sort, statistics, stats