Calculate Field

Calculate Field


This tool works with a input layer to calculate values for a new or existing field. Build an Arcade expression to calculate the values to populate features with. If your data is time-enabled and of time type instant, you can optionally build expressions that are track aware.

For example, suppose you want to modify an existing field named TotalSales. You want the field to be represented by the sum of the total sales in 2016 and 2017. Using those fields in the expression, you calculate the field value as

$feature["Sales2016"] + $feature["Sales2017"]
.

Using another example, suppose you have GPS measurements that record the location, time, bus ID, and speed of the busses in a city. We want to create a new field called SpeedFrom3 that averages the speed of the last 3 recorded GPS measurements for each feature. For this calculation we would use a track aware calculation, where the track is a bus denoted by the bus ID. The calculation to determine the average speed of the previous 3 time steps and the current time step is

average($track.field["speed"].history(-4))
.

Choose layer to calculate field values for


The points, lines, areas, or table that will have field values calculated.

In addition to choosing a layer from your map, you can choose Browse Layers at the bottom of the drop-down list to browse to your contents for a big data file share dataset or feature layer.

Calculate field values for the field


The new or existing field that will have values calculated and the data type of that field. If you are calculating values on a field that already exists, you do not need to match the data type.

Build an expression condition to signify the start of an incident


Add an expression using the expression builder to calculate field values.

For example, suppose we want to add the values of a field named income and bonus. To do this, add the expression $feature["income"] + $feature["bonus"] .

This expression is track aware


Specify if your expression is track aware. A track aware expression will include formatting like

$track.field["fieldname"].history(...)
. Track aware expressions require fields to identify individual tracks. Tracks can be composed of points, lines, areas or tables and only require that the input has a track identifier and the data is time-enabled of time type instant.

Result layer name


The name of the layer that will be created in My Content and added to the map. The default name is based on the tool name and the input layer name. If the layer already exists, the tool will fail.

Using the Save result in drop-down box, you can specify the name of a folder in My Content where the result will be saved.