Calculate (Feature Service/Layer)
- URL:http://<featurelayer-url>/calculate
- Required Capability:Update
- Version Introduced:10.3
Description
The calculate operation is performed on a feature service layer resource. It updates the values of one or more fields in an existing feature service layer based on SQL expressions or scalar values. The calculate operation can only be used if the supportsCalculate property of the layer is true.
Neither the Shape field nor system fields can be updated using calculate. System fields include ObjectId and GlobalId.
See Calculate a field for more information on supported expressions.
Request parameters
Parameter |
Details |
---|---|
where |
Description: A where clause can be used to limit the updated records. Any legal SQL where clause operating on the fields in the layer is allowed. Examples: where=POP2000 > 350000 where=CITY_NAME = 'Glendora' |
calcExpression |
Description: The array of field/value info objects that contain the field or fields to update and their scalar values or SQL expression. For more information on how to build expressions, see Calculate a field. Syntax: "calcExpression":[{"field" : <fieldname>, "value" | "sqlExpression": <value> | "expression"},...] Examples: "calcExpression":[{"field" : "Quality", "value" : 3}] "calcExpression":[{"field" : "A", "sqlExpression" : "B*3"}] |
sqlFormat |
Description: The SQL format for the calcExpression. The expression can take one of two formats. It can be either standard SQL92 (standard), or it can use the native SQL of the underlying datastore (native). The default is standard.
![]() The SQL format native is supported only for admin users and when useStandardizedQuery=false. Values: standard | native |
f |
Description: The response format. The default response format is html. Values: html | json |
JSON response syntax
{
"success" : <true|false>,
"updatedFeatureCount" : <count>
}
JSON response example
{"success":true,"updatedFeatureCount":51}