Form Calculation

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 NameTypeDescription
$featureFeatureExposes the feature's attributes for use in the calculation.
$originalFeatureFeatureThe previous state of the feature being calculated.
$editcontext.editTypeTextIndicates whether the edit event is INSERT, UPDATE, DELETE, or NA (not applicable).
$layerFeatureSetA collection of features in the same layer as $feature.
$datastoreFeatureSetCollectionA collection of layers in the same feature service or database as $feature.
$featureSetFeatureSetA collection of features in the same table as $feature.
$mapFeatureSetCollectionA 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.

Use dark colors for code blocksCopy
1
2
3
4
var fullName = IIF(!IsEmpty($feature.InspectorFirst) && !IsEmpty($feature.InspectorLast)){
  return $feature.InspectorFirst + " " + $feature.InspectorLast;
}
return fullName;

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