ArcGIS Arcade is a simple, portable scripting language for creating custom, dynamic expressions and can be used in a variety of contexts within ArcGIS Pro including dynamic visualization and labeling, custom popup content, and field calculation. Custom Arcade expressions are cross platform, giving you the ability to write code for Pro and then publish to ArcGIS Online.
In this tutorial you’ll learn how to add Arcade expressions to custom pop-up window content in ArcGIS Pro including titles, text, attribute display, and charts.
We’ve also put together a video tutorial below if you’d prefer to watch instead of read.
Link to exercise data for this tutorial. Please create a c:\Student\ArcGIS Pro Shorts\Creating Custom Popups folder and unzip the exercise data to this location.
- Start ArcGIS Pro and open the CustomPopups.aprx project found in your c:\Student\ArcGIS Pro Shorts\ Creating Custom Popups folder.
- The LandParcels layer should be visible in the Contents pane. Right click LandParcels and select Configure Pop-ups.
- The Configure Pop-ups pane includes an Expressions button that you can click to display a pane of existing Expressions as well as a button for creating new expressions. Click the Expressions button to display the Expressions pane.
Open the attribute table for the LandParcels layer. Take a look at the OWNER_NAME field. Notice that it contains all uppercase text. We can use Arcade to change that to proper casing where only the first letter of each word is capitalized.
- Click the New button on the Expressions pane to display the Expression Builder pane.
- Change the name from expression0 to OwnerName.
- Click the Filter button to the right of Functions and select Text. Your Expression Builder pane should now appear as seen below.
- Double click the Proper() function to add the function call to the Expression. Then, put your mouse cursor inside the parentheses for the Proper() function and double click the OWNER_NAME field. Your expression should now appear as seen below.
- Validate the expression by clicking the green checkmark.
- Click OK. The Expressions pane should now appear as seen below. There isn’t a limitation on the number of expressions you can add, and they can be edited as well.
- Click the back arrow button to return to the main interface for the Configure Pop-ups pane.
- Click the pencil icon on the Field content element. Scroll to the bottom of the list of fields and you should see an item for Custom (expression/OwnerName).
Make sure it is checked and then scroll up to the OWNER_NAME field and turn off the display of that column.
- Click the back arrow to save the changes.
- Identify a parcel and you should see the result of the Arcade expression. Note: The chart and link to the Appraisal District Website you see below was created in earlier exercises in our Creating Custom Pop-ups class. If you’re following along with this exercise you won’t see those two items in your pop-up.
Notice that the column is listed at the bottom of display. Let’s move the column up so that it is just below the PROP_ID field. Click the pencil icon for the Fields content element, scroll to the bottom, and then with your mouse, drag and drop the column under the PROP_ID field.
- Click the back arrow to commit the change.
- Identify a feature to see the change in location.
- You may have also noticed that the field is simply called Custom. This can be changed as well. On the Configure Pop-ups pane click the Expressions button.
- Click the pencil icon for the custom expression you created earlier.
- Change the title to Owner Name as seen below.
- Click Ok.
- Click the back arrow button to commit the changes.
- Identify a feature to see the change.
Arcade expressions can also be used in text and chart elements. For more information on Arcade please see our Getting Started with ArcGIS Arcade class. It takes about a day to understand the Arcade language and how it can be used in ArcGIS Pro.