Calculate Field

Calculate Fields tool icon The Calculate Field tool calculates new field values for features. Calculated values may be stored in new or existing fields (in which case, the original field value will be overwritten). Additionally, the Calculate Field tool can modify existing geometry or create new geometry including changing the geometry type. Multiple field calculations can be configured and run at the same time.

Examples

  • A field contains strings in all uppercase 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 proper case.
  • A field contains coded values. You can configure the Calculate Field tool with Arcade's 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. The Calculate Field tool can calculate the new geometry and replace the existing point with predicted new location.

Usage notes

  • Calculating fields is done using Arcade expressions. For details, see Use Arcade expressions. Arcade is a lightweight and secure expression language written for use in the ArcGIS platform. Like other expression languages, it can perform mathematical calculations and evaluate logical statements. For a full overview of expressions and functions supported, 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, that field will be converted to Float64 and be listed as type Double in any associated map or feature services.

Parameters

ParameterDescriptionData Type

Input Layer

The features for which fields will be calculated.

Feed or source

Field Choice

Whether the calculated value will be placed in an existing field, a new field, or if geometry is being 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

  • An Arcade expression that will be evaluated to produce the new field value.
  • The Arcade expression builder provides support for composing calculations and referencing the syntax of various functions.
  • Existing field names are referenced with the prefix $feature. For example:

    $feature.ground_speed_meters / 3.28084

Arcade expression

Output layer

The output layer fields and attribute values will depend on the configuration of the Calculate Fields tool.