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 fields or overwrite existing fields. You can also 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 Decode ArcGIS Arcade 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. 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.
- ArcGIS clients currently do not support 64-bit integer field types. For this reason, if a field is designated as Int64, it is converted to Float64 and assigned the type Double in any associated map or feature services.
- Geometry calculation with this tool is currently restricted to the Well-known ID (WKID) spatial reference. The Well-known text (WKT) spatial reference is not supported by the Arcade geometry function.
- Data fields with the Int64 type support whole numbers between -(2 53) -1 and (2 53) -1. Attempting to read or write numbers outside this range may result in rounding of the value.
- This tool requires an input feed or source.
- Click Add field calculation to add new calculations. Options include the following:
- New field—Create a field using an Arcade expression
- Existing field—Update an existing field's value using an Arcade expression
- Geometry—Construct an Esri geometry object for feature geometry using an Arcade expression
Parameters
The following are the parameters for the Calculate Field tool:
Parameter | Description | Data type |
---|---|---|
Field | The name of the new or existing field in which the output value is to be stored. This parameter is enabled for new and existing field calculations. | String |
Type | The field type for the output value. This parameter is only enabled for new field calculations. | String |
Expression |
| Arcade expression |
Output layer
The output layer fields and attribute values depend on the configuration of the Calculate Field tool.