ArcGIS Arcade can be used to calculate fields in records captured with QuickCapture. A project author can write an expression that uses Arcade functions, operators, and record values.
The Arcade QuickCapture profile includes the following variables that can be used to return record values:
- $feature—Attributes of the current record
- $layer—Features in the same layer as the current record
- $datastore—Layers in the same feature service or database as the current record
- $map—Collection of feature service layers in the web map that is used by the QuickCapture project
For more information, see QuickCapture profile variables.
By default, the project web map does not include the project layers, so to be able to use expressions that reference layers by name, for example, var layername = FeatureSetByName($map, "layer_name"), you must either choose the option to create a web map when configuring the QuickCapture project, or replace the default web map with one that contains all the layers needed for the expression. For more information, see Project map configuration.
Note:
If you plan to use Arcade expressions in your project, check the project layers and web map for the DateOnly, TimeOnly, TimestampOffset, or BigInteger field types. You must create a hosted feature layer view that excludes these fields and use the layer view in the project instead. These field types are not supported by the Arcade version (1.18) used by the QuickCapture mobile app.
The following are example use cases that can be constructed as an Arcade expression:
- Calculate a value from values coming from another field
- Do a point in polygon query to return an attribute value
- Use a function to calculate the time duration of a captured polyline
The QuickCapture designer includes an expression builder to help authors write expressions and uses the QuickCapture profile. Similar to how user inputs are defined once and usable in more than one button, once an Arcade expression is saved in the designer, it can be assigned to more than one button.
Arcade expressions can be configured by the project author on the Data tab for each field. To assign an Arcade expression to a capture field of a button, on the Data tab, from the drop-down menu of the capture field, choose Arcade expression and select Create new.
Fields that are managed by ArcGIS—such as OBJECTID, GlobalID, CreationDate, Creator, EditDate, and Editor—should not be used in an expression because their values are not known until after a record is submitted. If an expression requires a value for a username or record capture date, the expression should reference a field that has been populated with a device variable.
Note:
Records captured when the device is offline that contain Arcade expressions will only be processed when the device is next online, and only then will they be sent.