Show Related Records in Pop-Up

20180
25
08-04-2016 10:42 AM
Status: Open
ChristopherStrong
Occasional Contributor

There have been other versions of this idea that have been flagged as "implemented", (https://community.esri.com/ideas/9541 and https://community.esri.com/ideas/11131 ) but the ability to show or format related records in the pop-up still does not exist.

It would be great to show a list of the related records in a feature's pop-up.  I'd like people to be able to view different contact information when clicking on a building, but the only way for this to work currently is by creating a long one-to-one join and publishing that as a service or by forcing users to open the table.  Both have implications with data design and user experience.

Both of the previous ideas where marked as implemented, but the 2016 update to ArcGIS Online only added related table functionality in the webmap's Details Page (which is not a user friendly way to interact with a webmap).  The 2016 update also allowed the ability to summarize related data (Configure pop-ups—ArcGIS Online Help | ArcGIS ), so one-to-many relationships with text display a feature count.  Again, while an improvement, this isn't terribly helpful for those wanting to view one or two details stored in a related table.

I understand it may be difficult to display potentially complex relationship information in a small pop-up, but I have faith in ESRI finding a way to make this better if they continue to work on it.

25 Comments
VHolubec

It seem that Map Viewer beta can add Related Records to pop-up now. 

Dear ArcGIS Online Map Viewer Beta, do you plan some "arrow button" to iterate thru multiple related records in the pop-up? Now I am able just to display ONE and not MANY.

Thanks

by Anonymous User

I just successfully used the Arcade exression that @MichaelKelly3  posted above, to display the related records in my pop. So thank you for posting that as I'm new to Arcade.  I'm struggling with a way to display a field as a hyperlink in my pop up. I know how to make hyperlinks in the configure pop up designer, but since the expression is one item, I can't see a way to interact with the field I'm returning.  
Any ideas?

ChristalHigdon_USFS

Pop-ups: related records still shows No Support in the Map Viewer.
Please implement this Esri!
https://doc.arcgis.com/en/arcgis-online/reference/limitations-and-compatibility-mv.htm

We also need html functionality and table formatting for the pop ups.

HollyTorpey_LSA

I also was able to use the code posted above by @MichaelKelly3 to display related records collected by a Survey123 XLSForm repeat. Big thanks to Michael!!

Here's my modified version in case it helps anyone with formatting multiple related records fields:

 

var related_table = FeatureSetById($datastore, "1");
var filter_query = "parentglobalid = '" + $feature["globalid"] + "'";
var related_data_filtered = Filter(related_table, filter_query);
var related_data_filtered_count = Count(related_data_filtered);
var output = "";
var num = 0;

if (related_data_filtered_count > 0) {
    output = "Total of " + related_data_filtered_count + " additional elevations";
    for (var related_data_row in related_data_filtered) {
        num += 1;
        output += TextFormatting.NewLine + TextFormatting.NewLine + "Additional Elevation Exposure " + num + ": " + related_data_row.elevation_exposure;
        output += TextFormatting.NewLine + "Description: " + related_data_row.elevation_comments;
        output += TextFormatting.NewLine + "Porch: " + replace(replace(related_data_row.elevation_porch, ",",  ", "), "_", " ");
        output += TextFormatting.NewLine + "Other Porch Type: " + related_data_row.elevation_porch_other;
        output += TextFormatting.NewLine + "Piers: " +  related_data_row.elevation_piers;
        output += TextFormatting.NewLine + "Door: " + replace(replace(related_data_row.elevation_door, ",", ", "), "_", " ");
        output += TextFormatting.NewLine + "Other Door Type: " + related_data_row.elevation_door_other;
        output += TextFormatting.NewLine + "Windows: " + replace(replace(related_data_row.elevation_windows, ",", ", "), "_", " ");
        output += TextFormatting.NewLine + "Other Window Type: " + related_data_row.elevation_windows_other;
        output += TextFormatting.NewLine + "End Vents: " + related_data_row.elevation_end_vents;
        output += TextFormatting.NewLine + "Wall Cladding: " + replace(replace(related_data_row.elevation_wall_cladding, ",", ", "), "_", " ");
        output += TextFormatting.NewLine + "Other Wall Cladding Type: " + related_data_row.elevation_wall_cladding_other;
        output += TextFormatting.NewLine + "Skirting: " + replace(replace(related_data_row.elevation_skirting, ",", ", "), "_", " ");
        output += TextFormatting.NewLine + "Other Skirting Type: " + related_data_row.elevation_skirting_other;
    }
} else {
    output = "No additional elevations";}
return output;

This returns a block of text in list form that can be added to a fields list or inserted into a text block in a popup.

 

MatthewCriel

Here is my solution for this

I made a Arcade Popup Expression that will return the value to the popup:

var relatedRecords = FeatureSetByRelationshipName($feature, "RelateName");
var relatedRecord = First(relatedRecords);
return relatedRecord.Fieldname;