Profiles

A profile defines the environment and rules for how an Arcade expression is evaluated and interpreted. An Arcade profile specifies:

  • the execution context - or the environment controlling the expression's execution,
  • the profile variables that can be used as input data values to the expression,
  • the function bundles available, and
  • the valid data types that may be returned from an expression.

See the Profile specifications to read about the profiles supported in ArcGIS products.

Execution context

The execution context of a profile defines:

  • where an Arcade expression executes, including the app or product controlling the execution
  • the default spatial reference used by geometry functions, and
  • the default time zone used when constructing and displaying date and time values.

For example, you can author an Arcade expression that returns text as a label for your features within a map. The execution context for the labeling profile specifies that the labeling engine of the ArcGIS product where labels are displayed (e.g. ArcGIS Pro, ArcGIS Online, etc.) controls the execution of the Arcade expression that determines the label text for each feature in the layer. The expression must be defined in the labelingInfo property (of web maps) for the labeling engine to know where to find the expression. The default spatial reference and time zone of the labeling context is the same spatial reference and time zone as the map or view where labels display.

Profile variables

A profile variable represents the input values to an expression. It is always preceded with a $ character. The profile variables available to an expression will vary depending on its context. See the Profile variables documentation for more information.

Use dark colors for code blocksCopy
1
2
3
// $feature is a profile variable representing the attributes
// and geometry of a feature used as input for a popup or a renderer
$feature.POPULATION  / AreaGeodetic($feature, "square-miles")
Use dark colors for code blocksCopy
1
2
// $map is a profile variable representing the layers in the feature's map
var publicLandFeatures = FeatureSetByName($map, "public lands", ["class"], true);

Function bundles

Not all Arcade functions are suitable for every profile. For example, profiles that execute expressions for all features in a layer (e.g. visualization and labeling) don't allow expressions to access data via FeatureSet functions.

Each profile's specification defines which function bundles are included in the profile.

Data types

The profile defines the valid data types that may be returned from an expression. If the expression returns an invalid type, the profile will attempt to implicitly cast the value to a valid type.

For example, the popup profile allows you to return a Text or a Number. If you author an expression that returns a Date, then the profile will cast the date to a text value.

Use dark colors for code blocksCopy
1
2
// Will display as a text value: 2022-08-22T14:21:53.460-07:00
Now()

It is always best to explicitly return the proper data type.

Use dark colors for code blocksCopy
1
2
// Will display as a text value: 09-09-2022
Text(Now(), "MM-DD-YYYY");

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