Unveiling Multi-Level Related Records in Pop-ups with Arcade

Unveiling Multi-Level Related Records in Pop-ups with Arcade

Arcade, a versatile expression language, empowers users to craft custom pop-up content, generate unique labels, derive new values from existing data, and establish data rules. This article delves into a commonly encountered scenario involving two levels of relationship classes and the display of this interconnected information through pop-ups. The tools at our disposal for this task are the Map Viewer and Arcade, available in Enterprise 11.1.

Consider a Hosted Feature Service named “Incidents” (alternatively, it could be a Federated Feature Service). This service comprises the following layers, tables and relationships:

Our objective is to display the information from Investigation Actions in the pop-up of “Incident” points when users interact with the points on a web map.

Scenario:

Let’s illustrate this with a scenario and Figure 2 below: An Incident (Blue) was logged regarding a fallen tree obstructing a well-frequented hiking trail. This Incident prompted two separate Investigations (Yellow) – an initial inspection and a follow-up after the tree’s removal. Each Investigation led to specific Actions (Green), such as closing the trail for maintenance, scheduling tree removal services, and reopening the trail post the final Investigation.

 In this context, when a user accesses the pop-up of the “Fallen Tree” Incident point on a map, they would want to view all three subsequent Actions. 

Custom Attribute Expression:

Achieving this involves creating a custom Attribute expression while configuring the pop-up for the Incident layer. This expression aims to locate all related Investigations, and subsequently, all Actions tied to these Investigations. The resulting values are returned as text, which can be incorporated into a table, text, or field view.

Here’s the Custom Attribute Expression (notice that it concatenates multiple fields, ‘actionsdate’ and ‘purpose’ to return it as a single value):

The returned value from the custom attribute can be added as another field in the pop-up:

Or it can be added as a table element in the pop-up, adhering to the principles outlined in this article: https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/authoring-pop-ups-using-html-source-editing/

Additionally, multiple custom Attribute Expressions can be created to return the values from related Actions separately instead of concatenated so that each Action Attribute can be shown in a separate column in the pop-up instead:

The HTML or source for the pop-up Text element that creates the table:

<table style=”width:90%”>
  <tbody><tr>
    <td>Action Date</td>
    <td>Action Description</td>
  </tr>
  <tr>
    <td>{expression/expr0}</td>
    <td>{expression/expr1}</td>
  </tr>
</tbody></table>

This approach provides a comprehensive view of the Incident and the subsequent Actions from related Investigations, enhancing the user’s understanding and interaction with the hierarchical data.

In summary, Arcade’s powerful expression language, coupled with the Map Viewer, offers a dynamic way to surface and visualise multi-level related records in pop-ups. This not only enriches the user experience but also provides a deeper understanding of the data and its interconnections.

Get in touch with the team at GBS if you have any questions or would like to implement something similar within your Esri environment.

By Jade Weideman, Esri Techinical Consultant, GBS

Comments are closed.