Profiles

A profile is a context in which an Arcade expression is evaluated and understood. They expect specific inputs and output types depending on the use case. Arcade expressions may be executed in any of the following profiles:

See below for a more detailed explanation of the profiles, and how they are used.

Alias

The alias profile allows the map author to write an expression to evaluate a numeric value and return a string alias representing that value.

When the alias is needed, the script will be evaluated. It will be passed the value for which an alias is desired. It is expected that the script returns a text string, comprising the alias to be shown.

Globals

Variable Name Type Description
$value Number The numeric value for which a string alias is desired.

Return types

Text

Attribute Rules

The following profiles are designed for Attribute Rules.

Evaluation of batch calculation and validation rules is available at ArcGIS Enterprise 10.7 or later.

Attribute Rule Calculation

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.

Globals

Variable Name Type Description
$feature Feature The feature being calculated.
$datastore FeatureSetCollection A collection of layers in the same feature service as the $feature executing the script.

Return types

Number | Text | Date | Dictionary (success) | Dictionary (failure)

Dictionary Success
Property Name Type Description
result Number | Text | Date The result of the calculation.
validationRequired Array Optional An array of the features that need to be marked as requiring validation.
calculationRequired Array Optional An array of the features that need to be marked as requiring calculation.
Dictionary Failure
Property Name Type Description
errorMessage Text Message to display if an error occurs while the rule evaluates.

Examples of this profile in context

Attribute Rule Constraint

With the Attribute Rule Constraint profile, expressions can be written to evaluate whether or not a feature meets the criteria defined in the expression. This profile is used for constraint attribute rules in ArcGIS Pro. The script should return a Boolean with true indicating the feature meets the constraint criteria or false indicating it does not meet the criteria. You can also return a custom error message by returning a Dictionary of errorMessage.

Globals

Variable Name Type Description
$feature Feature The feature being evaluated for the constraint.
$datastore FeatureSetCollection A collection of layers in the same feature service as the $feature executing the script.

Return types

Boolean | Dictionary (failure)

Dictionary Failure
Property Name Type Description
errorMessage Text Message to display if an error occurs while the rule evaluates.

Examples of this profile in context

Attribute Rule Validation

With the Attribute Rule Validation profile, expressions can be written to evaluate whether or not a feature meets the criteria defined in the expression. This profile is used for validation attribute rules in ArcGIS Pro. The script should return a Boolean with true indicating the feature meets the validation criteria or false indicating it does not meet the criteria.

Globals

Variable Name Type Description
$feature Feature The feature being evaluated for the constraint.
$datastore FeatureSetCollection A collection of layers in the same feature service as the $feature executing the script.

Return types

Boolean | Dictionary (failure)

Dictionary Failure
Property Name Type Description
errorMessage Text Message to display if an error occurs while the rule evaluates.

Examples of this profile in context

Validation attribute rule examples in ArcGIS Pro

Constraint

With the Constraint profile, expressions can be written to evaluate whether or not a feature meets the criteria defined in the expression. This profile is used for advanced attribute editing in the ArcGIS API for JavaScript. The script should return a Boolean with true indicating the feature meets the constraint criteria or false indicating it does not meet the criteria.

Globals

Variable Name Type Description
$feature Feature The feature being evaluated for the constraint.

Return types

Boolean

Examples of this profile in context

Field Calculate

With the Field Calculate profile, expressions can be written to update a field value based on expression logic. This profile is used in field calculation tools in ArcGIS Pro and ArcGIS Online. When the script is evaluated, the return value 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.

Globals

Variable Name Type Description
$feature Feature The feature being calculated.
$layer FeatureSet A collection of features in the same layer as $feature. Only supported for Feature Layers.
$datastore FeatureSetCollection A collection of layers in the same feature service as the $feature executing the calculation.

Return types

Date | Number | Text

Labeling

The labeling profile allows the map author to write an expression that determines the label to show on the map for each feature. The script evaluates for each label as it is to be drawn. It is expected that the script returns a string, comprising the label to be drawn.

Globals

Variable Name Type Description
$feature Feature The feature whose label is to be drawn on the map.

Return types

Text

Examples of this profile in context

With the popup profile, map authors can write expressions that return values for display in the view's popup. Expressions can be referenced in the popup content's text template, field tables, and media charts. When the popup displays, the script will execute using the feature's attributes as variables in the expression. The script should return either a string, number, or date and place it in the table cell or text comprising the popup's content. Values returned for charts will be used as the basis for the data-driven chart.

Globals

Variable Name Type Description
$feature Feature The feature whose popup is to be displayed in the view.
$layer FeatureSet A collection of features in the same layer as the $feature whose popup is displayed in the view. Only supported for feature service layers.
$map FeatureSetCollection A collection of feature service layers in the same map as the $feature whose popup is displayed in the view.
$datastore FeatureSetCollection A collection of layers in the same feature service as the $feature whose popup is displayed in the view.

Return types

Text | Number

Examples of this profile in context

Feature Z

With the Feature Z profile, expressions can be written to calculate z values for features in a 3D scene. This is useful for features that don't have z values included in their geometry, or for dynamically changing the z value of features either using the former z value, attribute values, or a combination of both. Expressions in this profile must return a Number.

Globals

Variable Name Type Description
$feature Feature The feature requiring a Z value.

Return types

Number

Examples of this profile in context

Visualization

The visualization profile allows the map author to write an expression that evaluates to a value used to drive the visualization. This could be used for a visual variable such as size, or as a value in a class breaks renderer. When the feature is to be drawn, the script will be evaluated. It is expected that the script returns a value specific to the rendering property being calculated (e.g. A number for a class breaks visualization or a string for a unique value visualization).

Globals

Variable Name Type Description
$feature Feature The feature which is to be drawn on the map.
$view.scale Number Returns the scale of the map at the time the expression evaluates.

Return types

Text | Number

Examples of this profile in context


Feedback on this topic?