HOW TO
Pop-ups in a map can be used to show information about features. Attribute data can be inserted into a pop-up, and attachments can be shown if the feature service is enabled to capture them. Attachment images can also be shown in the pop-up.
Attachments from a related table/layer can be viewed if related records are added to the pop up content for the parent layer and when related record is selected in the pop up. However, there is currently no out-of-the-box functionality to show attachments from a related table/layer directly in the pop-ups of the parent layer on a web map in ArcGIS Online.
This article explains the workflow in Map Viewer, however, the same Arcade expression can be used in Classic Map Viewer too.
// first read out the ID of the selected feature (the primary key of the relationship in the parent layer, in this case "globalid") var id = $feature.globalid; // access the related table (in this example "relatedtable" is the name of the related table/layer on the map) var tbl = FeatureSetByName($map, "relatedtable"); // create a sql expression to query related records based on the primary key and the foreign key for the relationship (in this case, "globalid" from the parent layer, and the "parnetglobalid" from the related layer/table) var sql = "parentglobalid = '" + id + "'"; // filter the table using the sql expression var related_data = Filter(tbl, sql); // return an attribute value from the related record (objectid and id of the first attachment) for (var row in related_data) { var reloid = row.objectid; var AttachID = First(Attachments(row)).ID} // other url parameters (Part1 is the REST URL of the hosted feature layer var Part1 = "https://services.arcgis.com/Wl7Y1m92PbjtJs5n/arcgis/rest/services/service_8d10508dd20f43e0a91faf21e4191f09/FeatureServer/1/" var Part2 = "/attachments/" //construct the attachment url var url = Part1 + reloid + Part2 + AttachID //return the url for the attachment return url
Notice in the screenshot below that now an image is added to the media content in the map's pop-up.
Considerations/Limitations:
Article ID: 000027210
Get help from ArcGIS experts
Download the Esri Support App