Available in real-time and big data analytics.
The Calculate Field tool calculates new field values for features. You can store calculated values in new or existing fields (in which case, the original field value will be overwritten). Additionally, you can use the Calculate Field tool to modify existing geometry or create geometry including changing the geometry type. Multiple field calculations can be configured and run at the same time.
Examples
The following are example uses of the Calculate Field tool:
- A field contains strings in all uppercase letters and you want to use the field in an output display. Use the Calculate Field tool to reformat the strings to all lowercase or to the correct case.
- A field contains coded values. You can configure the Calculate Field tool with the Arcade Decode function to change the codes in the existing field to the values they represent.
- A feature's schema contains fields for the area of the feature as well as some attributes such as population. Use the Calculate Field tool to add a field containing the population density of each feature.
- Incoming point features representing vessels at sea contain attributes for heading and speed and you want to predict where the ship will be in a given amount of time. Use the Calculate Field tool to calculate the new geometry and replace the existing point with the predicted new location.
Usage notes
Keep the following in mind when working with the Calculate Field tool:
- Fields are calculated using Arcade expressions. For details, see Use Arcade expressions. Arcade is a basic and secure expression language written for use in ArcGIS. As with other expression languages, it can perform mathematical calculations and evaluate logical statements. For an overview of supported expressions and functions, see the ArcGIS Arcade documentation.
- ArcGIS clients currently do not support 64-bit integer field types. For this reason, if a field is designated as Int64, it will be converted to Float64 and be listed as type Double in any associated map or feature services.
- Geometry calculation with this tool is currently restricted to the WKID spatial reference. The WKT spatial reference is not supported by the Arcade geometry function.
Parameters
The following are the parameters for the Calculate Field tool:
Parameter | Description | Data type |
---|---|---|
Input Layer | The features for which fields will be calculated. | Feed or source |
Field Choice | Specifies whether the calculated value will be placed in an existing field or a new field, or if geometry will be calculated for each feature. | String |
Field Name | The name of the new or existing field in which the output value will be stored. This parameter is only enabled if Field Choice is set to New Field. | String |
Field Type | The field type for the output value. This parameter is only enabled if Field Choice is set to New Field. | String |
Expression |
| Arcade expression |
Output layer
The output layer fields and attribute values depend on the configuration of the Calculate Field tool.