Since version: 1.17
With the Form Calculation profile, expressions can be written to update a form value based on expression logic. This profile is used when defining form calculations in Field Maps. 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.
Context
The following products implement this profile:
Spatial reference
The spatial reference of the map in which the expression executes determines the execution context's spatial reference.
Time zone
The time zone of the map in which the expression executes determines the execution context's default time zone.
Profile variables
Variable Name | Type | Description |
---|---|---|
$feature | Feature | Exposes the feature's attributes for use in the calculation. |
$originalFeature | Feature | The previous state of the feature being calculated. |
$editcontext.editType | Text | Indicates whether the edit event is INSERT , UPDATE , DELETE , or NA (not applicable). |
$layer | FeatureSet | A collection of features in the same layer as $feature . |
$datastore | FeatureSetCollection | A collection of layers in the same feature service or database as $feature . |
$featureSet | FeatureSet | A collection of features in the same table as $feature . |
$map | FeatureSetCollection | A collection of feature service layers in the same map as $feature . |
Function bundles
Core | Geometry | Data Access | Portal Access
Return types
Number | Text | Date | DateOnly | Time
Example
Returns the full name of the inspector, if both the InspectorFirst and InspectorLast fields are not empty.
var fullName = IIF(!IsEmpty($feature.InspectorFirst) && !IsEmpty($feature.InspectorLast)){
return $feature.InspectorFirst + " " + $feature.InspectorLast;
}
return fullName;