Editing with calculated field expressions

This sample demonstrates how to work with calculated field expressions while editing with the Editor widget. The FeatureForm widget provides the ability to calculate values by setting the field element's valueExpression. This property takes a reference to the name of an Arcade expression defined in the expressionInfos of the FormTemplate. Since the Editor widget consumes FeatureForm functionality, any set valueExpressions are automatically recognized.

How it works

The Editor's form displays with a configured FormTemplate upon update or creation of a new tree. This template contains groups of field elements where some of these field elements contain a valueExpression. Take note that fields containing a valueExpression cannot be modified directly within the form as they are dependent upon the returned value of the evaluated expression.

The following table lists the referenced Arcade expression names used in this sample with a short description of its behavior.

Arcade expression nameBehavior description
latitudePopulates the Latitude field element with the latitude coordinate of the tree.
longitudePopulates the Longitude field element with the longitude coordinate of the tree.
tree-dbhPopulates the Diameter at breast height (DBH) field element with the tree's diameter. This is calculated using a provided circumference value and dividing this value by PI.
nearest-addressPopulates the Nearest address field element with the nearest address that intersects a given buffer of the tree location.
current-userPopulates the Collected by field element with the portal userInfo's full name. Since this data is open, it is set to anonymous.
municipalityPopulates the Municipality field element with City of Redlands.
districtPopulates the District or neighborhood field element with the corresponding district that intersects this tree's location.

The expression must follow the Form Calculation Profile specification.

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