Since version: 1.20
Arcade expressions can be written to calculate fields in records captured with ArcGIS QuickCapture. When the user taps a button in the project, a feature is captured and the app subsequently uses the Arcade expression to populate the value of one of the fields. Then the feature is sent to the underlying ArcGIS service. 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 $feature
is rendered determines the spatial reference of the expression's execution context.
Profile variables
Variable Name | Type | Description |
---|---|---|
$feature | Feature | Exposes the feature's attributes for use in the calculation. |
$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 . |
$map | FeatureSetCollection | A collection of feature service layers in the map used by the QuickCapture project. This variable may be null. |
Function bundles
Core | Geometry | Data Access
Return types
Example
Save an attribute from an underlying polygon
// Create a feature set using the 'Regions' layer in the map
var regions = FeatureSetByName($map, 'Regions', ['name']);
// Intersect the current location with the regions and
// get the first region
var region = First(Intersects($feature, regions));
// If the current location does intersect a feature,
// return the name of the region. Otherwise, return null
if (HasValue(region, "name")) {
return region['name'];
} else {
return null;
}
Calculate a value from other fields
if( !IsEmpty($feature.InspectorFirst) && !IsEmpty($feature.InspectorLast) ){
return $feature.InspectorFirst + " " + $feature.InspectorLast;
}