This sample demonstrates how to integrate the Arcade Editor with a Feature Table to write and test Arcade expressions and preview calculated values across multiple features.

It loads a public Hydrants feature layer and displays up to 25 hydrants with flow measurements. The initial expression converts flow rates from gallons per minute (GPM) to liters per minute (L/min). The table updates automatically as the expression changes, so you do not need to click Run to refresh it.

The editor’s Run action tests the expression against only the test feature identified above the editor. Separately, the application uses the Arcade execution API to calculate values for all queried features and update the client-side preview layer shown in the table.

Round($feature.FLOW * 3.78541, 1)

Profile and test data

An Arcade profile defines the context for an expression, including its available variables and functions. This sample uses the Field Calculation profile to calculate a value for each feature.

The editor’s profile uses the predefined profile form: id selects Field Calculation, and definitions maps $feature and $datastore to the source FeatureLayer. The layer provides field and service metadata for editor suggestions and validation; it is not the feature being tested.

arcadeEditor.profile = {
id: "field-calculation",
definitions: {
$feature: featureLayer,
$datastore: featureLayer,
},
};

In contrast, testData supplies the actual values for the first table row’s feature when using the editor’s Run action.

arcadeEditor.testData = {
profileVariableInstances: {
$feature: features[0],
$datastore: featureLayer.url,
},
spatialReference: featureLayer.spatialReference,
};

Preview calculated values

The Arcade Editor authors and tests expressions against its test data. To use an expression in the application, the app separately compiles it with createArcadeExecutor() and evaluates it against each queried feature. This makes the results available to other UI, such as the Feature Table. The table recalculates when the editor emits arcgisScriptChange. The app uses createArcadeProfile() to create the same Field Calculation profile for execution.

const arcade = await $arcgis.import("@arcgis/core/arcade.js");
const profile = arcade.createArcadeProfile("field-calculation");
const executor = await arcade.createArcadeExecutor(arcadeEditor.script, profile);
const result = await executor.executeAsync({
$feature: feature,
$datastore: featureLayer.url,
});

For each feature, the application passes its Object ID and calculated FLOW_LPM value to applyEdits() to update the matching feature in the client-side preview layer. This does not modify the hosted hydrant layer. The table’s refresh() method displays the updated values beside the original FLOW values.

Compilation errors, execution errors, and nonnumeric results appear in a notice rather than overwriting the preview with invalid values. Correcting the expression automatically refreshes the results.

Arcadearcgis-arcade-editorarcgis-feature-tablecoding-componentsmap-componentscalcite-panelcalcite-noticecalcite-componentsfield-calculation5.2