HOW TO

Display string field attributes from a related table in ArcGIS Online Map Viewer Classic pop-ups

Last Published: August 24, 2021

Summary

When configuring pop-ups of a layer in ArcGIS Online Map Viewer Classic, Configure Attributes provides the option to choose fields from a related table to be displayed in the pop-up. Related fields include {relationships} in the field name. In a one-to-many relationship, displaying related attributes of a string field in the pop-up shows the count instead of the text values. Refer to ArcGIS Online: Show related data for more information.
The image below shows a pop-up displaying the count for the string field (Land_Use) from a related table, and the original attributes of the field in the attribute table.

The string field from the related table displaying as count in the pop-up.
Note:
This limitation only occurs in ArcGIS Online Map Viewer Classic.
This article describes the steps to display the attributes from a related table string field in the ArcGIS Online Map Viewer Classic pop-up using Arcade and the FeatureSetByName expression.

Procedure

In ArcGIS Online, open the web map or hosted feature layer in Map Viewer Classic, and configure the pop-up to display the related table string field using the attribute expression provided below. Refer to ArcGIS Online: Use attribute expressions for steps to do this. Replace Related Table Name with the name of the related table, Field Name with the string field name to be displayed in the pop-up, and Common Field Name with the name of the field that the relate is based on.

var tbl=FeatureSetByName($datastore,"Related Table Name",['Field Name'])
var fc=$feature.Common Field Name
var sql = 'Common Field Name=@fc'
var relatedData=filter(tbl,sql)
var cnt=count(relatedData)
console(cnt+' Records')
var result=''
if(cnt>0){
  for (var r in relatedData){
    var x =r.Field Name
    result += text(x)
    console(x)
  }
}
return result

The image below shows the configured expressions to display the string field (Land_Use) from the related table (Land_Type). The common field name in this example is OBJECTID.

Custom attribute expressions written in the Arcade expression language to display the string field from the related table in the pop-up.

The image below shows the pop-up displaying text values from the string field.

The pop-up displaying fields from the layer's attribute table and related table with custom expressions.

Article ID:000025806

Software:
  • ArcGIS Online

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

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options