Profiles

A profile is a context in which an Arcade expression is evaluated and understood. Arcade expressions may be executed in any of the following profiles: alias, calculation, constraint, labeling, popups, and visualization. These profiles expect different inputs and provide different output types.

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.

The following global variables are passed into the script when it executes.

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

Calculation

With the calculation profile, expressions can be written to update a field value based on expression logic. The calculation profile is used in field calculation tools and calculation attribute rules.

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.

Variable Name Type Description
$feature Feature Contains the feature being calculated.

Examples of this profile in context

Constraint

With the constraint profile, expressions can be written to validate whether or not a feature meets the criteria defined in the script. The script should return a Boolean with true indicating that the feature meets the constraint criteria or false indicating it does not meet the criteria.

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

Examples of this profile in context

Labeling

The labeling profile allows the map author to write an expression to evaluate which label to show on the map for each feature and how to format that label.

When the label is to be drawn, the script will be evaluated. It will be passed the feature that is about to be labeled. It is expected that the script returns a text string, comprising the label to be drawn.

The following global variables are passed into the script when it executes.

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

Examples of this profile in context

Popups

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 evaluate using the feature's attributes as variables in the expression. The script will return either a string or a number 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.

The following global variables are passed into the script when it executes.

Variable Name Type Description
$feature Feature Contains the feature whose popup is to be displayed in the view.

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.

The following global variables are available to the script when it executes.

Variable Name Type Description
$feature Feature Contains 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.

Examples of this profile in context


Feedback on this topic?