Attribute Rule Calculation

Since version: 1.5

With the Attribute Rule Calculation profile, expressions can be written to update field values based on expression logic. This profile is used for calculation attribute rules tools in ArcGIS Pro. When the attribute rule is evaluated for a dataset, the return value for the expression is cast to the field type of the output value. It is best practice to handle casting within the script for full control of casting behavior to Number, Date, or Text return types.


The following products implement this profile:

Spatial reference

The spatial reference of the expression's data source1 determines the execution context's spatial reference.

Time zone

The time zone of the expression's data source1 determines the execution context's default time zone.

Profile variables

Variable NameTypeDescriptionSince version
$datastoreFeatureSetCollectionA collection of layers in the same feature service or database as the $feature executing the script.1.5
$editcontext.editTypeTextIndicates whether the edit event is INSERT, UPDATE, DELETE, or NA (not applicable).1.10
$featureFeatureThe feature being calculated.1.5
$originalFeatureFeatureThe previous state of the feature being calculated.1.9
$featureSetFeatureSetA collection of features in the same table as the $feature evaluating the expression.1.13

Function bundles

Core | Geometry | Data Access | Database

Return types

Number | Text | Date | DateOnly | Time | Dictionary

For a list of valid dictionary keywords, click here.


The following expression demonstrates how to generate a unique id for each feature, if not already set.

Use dark colors for code blocksCopy
//Define the leading text, the trailing text and the delimiter for the ID
prefix = "ABC"
join_char = "-"
suffix = "XYZ"

//Ensure the ID is not already set, if it is, return the original id
if (IsEmpty($feature.assetid)) {
   // If you do not want to use a prefix, or suffix, remove it from the list
   return Concatenate([prefix, NextSequenceValue("GDB_SEQUENCE_NAME"), suffix], join_char)
else {
   return $feature.assetid
  1. Data source can be a file geodatabase, mobile geodatabase, or mobile service.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.