Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: StatisticDefinition

require(["esri/tasks/StatisticDefinition"], function(StatisticDefinition) { /* code goes here */ });

Description

(Added at v2.6)
The StatisticDefinition class defines the type of statistics, the field used to calculate the statistics and the resulting output field name. Used to specify an array of statistic definitions for a query's outStatistics property. Requires ArcGIS Server service version 10.1 or greater

Samples

Search for samples that use this class.

Constructors

NameSummary
new StatisticDefinition()Creates a new StatisticDefinition object.

Properties

NameTypeSummary
onStatisticFieldStringThe field name or standard SQL expression on which statistics will be calculated.
outStatisticFieldNameStringSpecify the output field name.
statisticTypeStringDefine the type of statistic.
Constructor Details

new StatisticDefinition()

Creates a new StatisticDefinition object.
Sample:
require([
  "esri/tasks/StatisticDefinition", ... 
], function(StatisticDefinition, ... ) {
  var statisticDefinition = new StatisticDefinition();
  ...
});
Property Details

<String> onStatisticField

The field name or standard SQL expression on which statistics will be calculated. Standard SQL expressions are only supported on services where advancedQueryCapabilities.supportsSqlExpression is true. As of version 3.16, this capability is only available in ArcGIS Online hosted feature services.
Sample:
// Using a field name
statisticDefinition.onStatisticField = "POP2000";

// Using a SQL expression to calculate population density stats
statisticDefinition.onStatisticField = "POP2000 / AREA";

<String> outStatisticFieldName

Specify the output field name. Output field names can only contain alpha-numeric characters and an underscore. If no output field name is specified the map server assigns a field name to the returned statistic field.
Sample:

statisticDefinition.outStatisticFieldName = "TotalPop";

<String> statisticType

Define the type of statistic.
Known values: 'count'|'sum'|'min'|'max'|'avg'|'stddev'
Sample:

statisticDefinition.statisticType = "sum";

Show Modal