PROBLEM
In ArcGIS Online Map Viewer you can create pop-ups and include a related table of the hosted feature layer using an Arcade expression. However, you cannot add two related or multiple tables in a pop-up using an Arcade expression.
There are multiple limitations in ArcGIS Online:
While ArcGIS Online Map Viewer currently limits pop-up configuration to only one related table, an effective alternative workflow is available using ArcGIS Pro.



Code example:
// Get related records from Dataset A
var datasetARecords = FeatureSetByRelationshipName($feature, "Relationship_A");
// Get related records from Dataset B
var datasetBRecords = FeatureSetByRelationshipName($feature, "Relationship_B");
// Initialize a string to hold the output HTML
var result = "<h3>Debug Information:</h3>";
// Debug: Check if datasetARecords is null
if (IsEmpty(datasetARecords)) {
result += "<p>Error: Dataset A records are empty or null.</p>";
} else {
result += "<p>Dataset A records count: " + Count(datasetARecords) + "</p>";
}
// Debug: Check if datasetBRecords is null
if (IsEmpty(datasetBRecords)) {
result += "<p>Error: Dataset B records are empty or null.</p>";
} else {
result += "<p>Dataset B records count: " + Count(datasetBRecords) + "</p>";
}
// Initialize output HTML for Dataset A
result += "<h3>Dataset A Information:</h3><table border='1'><tr><th>Field 1</th><th>Field 2</th><th>Field 3</th><th>Field 4</th></tr>";
// Check if datasetARecords has data
if (Count(datasetARecords) > 0) {
// Loop through related records in Dataset A
for (var recordA in datasetARecords) {
var attributes = datasetARecords[recordA];
result += "<tr><td>" + attributes.FIELD1 + "</td><td>" + attributes.FIELD2 + "</td><td>" + attributes.FIELD3 + "</td><td>" + attributes.FIELD4 + "</td></tr>";
}
} else {
result += "<tr><td colspan='4'>No related records found.</td></tr>";
}
result += "</table>";
// Add Dataset B related data to the result
result += "<h3>Dataset B Information:</h3><table border='1'><tr><th>Field A</th><th>Field B</th><th>Field C</th><th>Field D</th></tr>";
// Check if datasetBRecords has data
if (Count(datasetBRecords) > 0) {
// Loop through related records in Dataset B
for (var recordB in datasetBRecords) {
var attributes = datasetBRecords[recordB];
result += "<tr><td>" + attributes.FIELDA + "</td><td>" + attributes.FIELDB + "</td><td>" + attributes.FIELDC + "</td><td>" + attributes.FIELDD + "</td></tr>";
}
} else {
result += "<tr><td colspan='4'>No related records found.</td></tr>";
}
result += "</table>";
// Return the final result
return result;
Article ID: 000037323
Get help from ArcGIS experts
Start chatting now