ArcGIS Online

Rolling Out Related Records in Map Viewer

Relationships are all around us, and as GIS professionals we try to capture, understand, and share these relationships. Knowing that, we’re excited to announce that Map Viewer now supports configuring and viewing related records through pop-ups! For those that aren’t familiar, related records, like their name suggests, are records from one dataset that relate to records of another dataset through a common field. In ArcGIS, relationships can occur between different forms of data. 

In this blog we’ll discuss how to display related data in your pop-ups through related record elements, Arcade attribute expressions, and Arcade elements. 

Configuring related record elements

To give you a better idea of just how quick the configuration process is, let’s walk through it with an example. When you add an ArcGIS Online hosted feature service with a preestablished relationship into Map Viewer, you can configure related records through the Pop-ups pane. Say we have a service with a one-to-many relationship between a bird observation layer and a bird behavior table, so each bird observation has one or more associated observations noting the bird’s behavior. We can use related record elements to change a simple bird location map to a data-rich map that provides insight into why bird species frequent or reside in certain habitats. To author this map, open the Pop-ups pane, add a related record element, provide a title and description, and sort the records by observation date to show the two most recent behavior observations. In just a few clicks, we’re able to dive deeper into our data.

Configuration of a related records pop-up element in Map Viewer.

Viewing related records

Let’s look at how to navigate and view related records through the lens of our bird observation example. Here is a breakdown of the related record element within the pop-up. The related record element is comprised of a title and description, a preview list of related records, and a Show all button.

A pop-up containing a related record element.

Clicking the Show all button shows a list of all the related records for that feature, as seen below. 

All related records for a single bird observation feature.

To return to the original pop-up, simply use the navigation buttons within the related record header. Clicking on one of the related records shows the pop-up for the selected related record, as seen below.

The pop-up from the related bird behavior table.

Nesting related records

In our bird observation example, a single relationship was present in the dataset between bird observations and behavior observations. What if a single layer or table in your dataset has multiple relationships? You can model several relationships by adding related record elements to the pop-ups of all the related layers. This is called nesting related records, and it allows you to access all related records through a single pop-up navigation experience. 

It’s always easier to understand concepts through an example, so let’s say our bird observation dataset has another table. This table contains the weather conditions collected with each behavior observation, so there’s a one-to-one relationship between the behavior and weather tables.  

The relationships between the related layer and tables.

This relationship diagram shows the layers and tables and their relationships within the bird observation dataset. 

To display this additional relationship in our map, we can simply add (or nest) a related record element within the bird behavior table pop-up. Now, the bird observation pop-up gives us access to not only the related bird behaviors, but also the related weather conditions, all within a single experience! 

Other ways to work with related records

You might recall that in Map Viewer Classic you can access fields from a related layer, get basic statistics on that field, and show those statistics within a pop-up fields list. We can do the same thing in Map Viewer using Arcade through attribute expressions and Arcade content elements. This allows greater flexibility and doesn’t limit you to a single statistic per related field. To do this, you can create an attribute expression using FeatureSetByRelationshipName() combined with your desired statistic function. Below is a quick example of how to get the average ground water elevation from a related table in the following map when users click on a ground water station. This map also contains the other examples shown below. 

Arcade expression to return the average ground water elevation value.

If you want to show multiple statistics in a pop-up, you can author an attribute expression for each statistic, or alternatively, you can use an Arcade content element to show all the statistics in a formatted list. By using the content element approach you will also increase overall performance as it will only make use of one FeatureSet execution vs. multiples when using the attribute expression approach. 

An Arcade content element with calculated statistics fields.

That’s not the only way to visualize related records. In some instances, it may make more sense to plot those records over time on a chart. This can be achieved using Arcade content elements.

Line chart of groundwater elevation levels from 1962 to 2022.

As you create engaging pop-ups using related records be sure to keep in mind these available options when designing the right experience for your audience.

Best practices when working with related records

Here are some tips to keep in mind when authoring related records: 

What’s next?

Browsing related records in pop-ups is only the tip of the iceberg for the work we have planned for related records in Map Viewer. Here are a few of the areas we’ll be focusing on in future releases: 

About the authors

Lauren Ballantyne is a Product Engineer on the ArcGIS Online team and has a background in environmental science and conservation ecology. Her feature areas include Map Viewer, Arcade, and hosted feature layer views. Lauren is passionate about developing intuitive tools that help create engaging, informative, and data-rich web maps.

Taylor is a Product Engineer on the ArcGIS Online team based in Ottawa, Ontario. She has received a BSc in Biology and a MSc in Applied Geomatics. When she's not at work, she can be found taking care of her houseplants, reading copious amounts of fiction, and exploring local thrift stores.

Product Engineer for ArcGIS Online and technology enthusiast.

Connect:

Next Article

Drawing a Blank? Understanding Drawing Alerts in ArcGIS Pro

Read this article