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.
The execution context of a profile defines:
- where an Arcade expression executes, including the app or product controlling the execution, and
- the default spatial reference used by geometry functions in this context.
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 set (e.g. ArcGIS Pro, ArcGIS Online, etc.) controls the execution of the labeling expression for each feature in the layer. The expression must be defined in the
labeling property (of web maps) for the labeling engine to know where to find the expression. The spatial reference of the labeling context is the same spatial reference as the map or view where labels display.
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.
// $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")
// $map is a profile variable representing the layers in the feature's map var publicLandFeatures = FeatureSetByName($map, "public lands", ["class"], true);
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.
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.
// 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.
// Will display as a text value: 09-09-2022 Text(Now(), "MM-DD-YYYY");