Show all related or joined attributes in a popup

999
1
Jump to solution
01-08-2020 09:45 AM
AlexMetzler
New Contributor III

My end goal is to view all related attributes in a popup in ArcGIS Online. I have a polygon feature class of buildings and a table of offices. Many offices can belong to one building. For example...

Building_IDName
001Building1
002Building2
003Building3
Building_IDOfficeName
001OfficeA
001OfficeB
002OfficeC
002OfficeD

The popup would look like this...

Building1

OfficeA

OfficeB

I am using ArcMap 10.7, SQL Server EGDB, standalone ArcGIS Server, and ArcGIS Online.

  • It seems doing a Join, I can do a one-to-many that produces duplicate features/records for each Office.
  • Publishing a relationship class provides a link to show related records but cannot be used to list attributes in the popup.
  • I've used Arcade before to reference other AGOL layers for popup content but am not sure the best setup to publishing the feature class and table (feature v. map service) for this to be as smooth as possible.
  • Also, thinking ahead to creating a View in the enterprise geodatabase, seems it would create multiple features like a join.

Any ideas how I can get the desired result of showing the related/joined attributes in a popup?

1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Hi Alex Metzler ,

I would probably just use a feature service. Publish the building featureclass and the table and create a web map with both the hosted feature layer and the table in it and then create a simple Arcade expression on the hosted feature layer pop-up:

var building_id = $feature["Building_ID"];
var office_tbl = FeatureSetByName($map,"Offices");
var sql = "Building_ID = '" + building_id + "'";
var offices = Filter(office_tbl, sql);
var cnt = Count(offices);

var result = "Building: " + building_id;
if (cnt > 0) {
    for (var office in offices) {
        result += TextFormatting.NewLine + " - " + office.OfficeName;
    }
} else {
    result += TextFormatting.NewLine + " - No offices in this building";
}

return result;

View solution in original post

1 Reply
XanderBakker
Esri Esteemed Contributor

Hi Alex Metzler ,

I would probably just use a feature service. Publish the building featureclass and the table and create a web map with both the hosted feature layer and the table in it and then create a simple Arcade expression on the hosted feature layer pop-up:

var building_id = $feature["Building_ID"];
var office_tbl = FeatureSetByName($map,"Offices");
var sql = "Building_ID = '" + building_id + "'";
var offices = Filter(office_tbl, sql);
var cnt = Count(offices);

var result = "Building: " + building_id;
if (cnt > 0) {
    for (var office in offices) {
        result += TextFormatting.NewLine + " - " + office.OfficeName;
    }
} else {
    result += TextFormatting.NewLine + " - No offices in this building";
}

return result;