HOW TO

Assign values in a new field based on values in another field for pop-ups with Arcade in ArcGIS Pro

Last Published: August 31, 2023

Summary

In ArcGIS Pro, Arcade expressions can be used to create a new field with values assigned based on the values of another field. This is useful for classifying the values of a field into groups of values in a new field.

This articles provides an example and instruction using the Find() Arcade expression in ArcGIS Pro. In this example, the Arcade expression is used to create a new field called Make_Grouping with values assigned according to the values in the Make field, as seen in pop-up in the image below.

The pop-up of the layer in ArcGIS Pro

Procedure

  1. Start ArcGIS Pro and open the project.
  2. In the Contents pane, right-click the feature class, and click Configure Pop-ups to open the Configure Pop-ups pane.
Opening the Configure Pop-ups tool of the feature class from the Contents pane
  1. Click Expressions, and click New.
  2. In the Expression Builder dialog box, configure the following parameters for the Arcade expression.
    1. For Name, rename the new expression.
    2. For Title, specify a title for the new expression.
    3. For the Expression section, insert the following Arcade expression.
if (Find("<uniquePartOfFieldValue>", $feature.<fieldName>, 0)>-1) {
   return "<newFieldValue>";
} else if (Find("<uniquePartOfFieldValue1>", $feature.<fieldName>, 0)>-1) {
   return "<newFieldValue1>";
}
The code below is an example of the full working script for assigning eight groups of field values in the Make_Grouping field based on the value in the Make field.
if (Find("Cl", $feature.Make, 0)>-1) {
   return "A";
} else if (Find("Io", $feature.Make, 0)>-1) {
   return "B";
} else if(Find("Ke", $feature.Make, 0)>-1) {
   return "C";
} else if(Find("Lu", $feature.Make, 0)>-1) {
   return "D";
} else if(Find("Mu", $feature.Make, 0)>-1) {
   return "E"
} else if(Find("Or", $feature.Make, 0)>-1) {
   return "F";
} else if(Find("Pa", $feature.Make, 0)>-1) {
   return "G";
} else if(Find("Wa", $feature.Make, 0)>-1) {
   return "H"
}
  1. Click Verify to run a test of the expression. If the expression is valid, click OK.
The Expression Builder dialog box with an example of the Arcade expression
  1. In the Configure Pop-ups pane, click Back The Back icon and click Edit pop-up element.
The location of the Edit pop-element icon in the Configure Pop-ups pane
  1. Ensure the newly created expression check box is checked in the Fields Options pane.
The Fields Options pane

The newly configured pop-up below displays the newly added Make_Grouping field with assigned values in the pop-up after using the Arcade expression.

The pop-up displaying the newly added Make_Grouping field in ArcGIS Pro

Article ID: 000031089

Software:
  • ArcGIS Pro 3 1
  • ArcGIS Pro 3 0
  • ArcGIS Pro 2 9x

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options