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_ID | Name |
---|---|
001 | Building1 |
002 | Building2 |
003 | Building3 |
Building_ID | OfficeName |
---|---|
001 | OfficeA |
001 | OfficeB |
002 | OfficeC |
002 | OfficeD |
The popup would look like this...
Building1 OfficeA OfficeB |
I am using ArcMap 10.7, SQL Server EGDB, standalone ArcGIS Server, and ArcGIS Online.
Any ideas how I can get the desired result of showing the related/joined attributes in a popup?
Solved! Go to Solution.
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;
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;