ArcGIS Online

Catch more waves using Arcade FeatureSet expressions in Forms

You work hard, you play hard. You spend lots of time and energy curating, managing and verifying large complex datasets. Then you head to one of your favorite spots to unwind, like Oahu’s North Shore. Now you can get even more free time by prepopulating fields in your data collection forms with data from other layers in Map Viewer, using ArcGIS Arcade expressions with FeatureSet. That way you can spend less time managing data and more time at the beach.


Chairs and umbrella on a beach

Arcade is a portable, lightweight, secure expression language used to create custom content in ArcGIS applications. Like other expression languages, you can use it to perform mathematical calculations, manipulate text, evaluate logical statements, and now with the latest update of ArcGIS Online, you can use FeatureSet functions inside the form builder.

Simply put, Arcade FeatureSet functions let you reference other layers within your map. In earlier versions of Map Viewer, you could use FeatureSet to pull information from other layers into a pop-up. Now you can leverage this ability in the form builder to get values from other layers in the map, and pull them into a data collection form. This means that fields prepopulate with the correct value anytime you create or update a feature, making both data creation and data management easier and more efficient.

How to use FeatureSet in a form

Let’s say you’re a GIS Analyst for the City of Honolulu. As part of a redevelopment initiative, new multi-family structures are being built to create more housing on the island. You’ll create a point for each new building, and use FeatureSets to access the zoning code for each new building.

All you need to get started is:

Once you add these layers to Map Viewer, you’ll create a form to collect data for each new building you put on the map. We’ll set up the form to pull data from the intersecting Zoning Codes polygon into a field in the New Address Point form. We can do this using an Arcade expression with both the FeatureSets and Intersect functions.

Layers added to Map Viewer appear in the Panel on the Left.
Set up your map with an editable layer and layers that contain the data you want to access

Follow along with these steps to get started:

Create a map

1. Add an editable point layer to Map Viewer, in this case New Address Points.

2. Add a polygon layer that contains the information you want, like Zoning Codes.

3. Let’s take a look inside the Zoning Codes attribute table. The field ‘zone_class’ contains the information you want to pull into the form.

A look inside the Zoning Codes attribute table

Configure the form

  1. With the editable point layer selected, click Forms Forms button on the Settings (light) toolbar.
  2. Add fields to the form by dragging the fields like Address and Zoning District onto the form.
Set up the form in the Configure Form window

3. In the form builder, Select the field you want to calculate (Zoning District).

4. In the Properties Pane on the right, scroll down to Calculated expressions.

Click to expand.

Author the expression

1. In the Calculated expressions section, click Add expression.

The Arcade expression editor window appears. This is where you can write and test your expressions. Have a look around. The editor window contains a title, an expression window, and a test button. There are also tabs that display globals, functions, constants, and existing expressions. We’ll give it a title and write an expression.

2. Click Edit next to the title and provide a title for the expression (ie. Zone Class).

3. Click Save.

Now its time to write the expression. You’ll combine ‘FeatureSet’ with a geometry function called ‘Intersect’ that allows you to get the value from a intersecting layer in the map.

You can copy and paste this expression, which returns the value from the field [‘zone_class’] in the intersecting layer, “Zoning Codes”. Let’s take a look at the expression.

Line 1 defines a FeatureSet called ‘zones’ using the name of the layer in the web map ($map).  The next line defines a variable that stores the [‘zone_class’] value from the first polygon that intersects any new point you place on the map ($feature). The last snippet returns a null value for any empty values, or areas where there is no intersecting polygon.

You can customize this expression to match the layer and field names from your own datasets.

3. Click Test to ensure the expression doesn’t result in an error. The result should be a value from the [‘zone_class’] field in the Zoning Codes table.

4. Click OK to close the Arcade editor.

The calculator icon indicates a calculated expression

Notice calculator icon next to the field Zoning District- this indicates that the field is populated using a calculated expression.

5. Click OK to save the expression and the form.

Give it a try

Open this map to discover just how easy it is to bring existing data into your forms. Here you can create a new feature following these steps:

1. Click Edit Edit button on the Settings (light) toolbar. The Editor pane appears.

2. Under Create features, Select New Address Point.

3. Click to place a point on the map.

The form opens. The field ‘Zoning District’ automatically populates with the [‘zone_class’] in the form.

Watch the form autopopulate in Map Viewer

And there you have it! You’ve just seen how you can use Arcade expressions with feature sets in forms in the latest release of ArcGIS Online. When you combine FeatureSet with a geometry function like Intersect, it populates fields in your forms with values from other layers in the map automatically.  This powerful functionality results in more streamlined editing workflows and ensures cleaner data from the start, so you can spend more time at the beach and less time cleaning up your data.

Now, go catch that wave!


About the author

Emily is a senior product engineer on the ArcGIS Online team. She joined Esri in 2022, bringing expertise in mapping, app creation, and data management. Emily is passionate about the outdoors, nature, and hiking. She often seeks refuge in wild areas and acoustic guitars.


Next Article

ArcGIS Enterprise on Kubernetes at the 2024 Esri User Conference

Read this article