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 name | Behavior description |
---|---|
latitude | Populates the Latitude field element with the latitude coordinate of the tree. |
longitude | Populates the Longitude field element with the longitude coordinate of the tree. |
tree-dbh | Populates the Diameter at breast height ( field element with the tree's diameter. This is calculated using a provided circumference value and dividing this value by PI. |
nearest-address | Populates the Nearest address field element with the nearest address that intersects a given buffer of the tree location. |
current-user | Populates the Collected by field element with the portal userInfo's full name. Since this data is open, it is set to anonymous . |
municipality | Populates the Municipality field element with City of Redlands . |
district | Populates 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.