3

I've created a relationship class in Desktop and published to ArcGIS Online as a service. The relationship still exists between my table and feature service but when I try to add one of the fields from the related table to my POP-UPS all I get is the count showing how many rows were returned in the related table. What I'd like is a ordered list showing the actual values, not the count. The cardinality of my join is many rows in the table to one value in the feature service (many:one). I find it odd that ESRI would include this functionality in their popups if all you could get is the count though I've read where a few others had the same issue. Perhaps Arcade expressions provide the answer. Does anybody know if it's possible to show the values from related tables in ArcGIS Online Pop-Ups?

2
  • Did you follow the steps here? Commented Feb 8, 2018 at 17:26
  • 5 years later, is it yet possible to just do a simple relate in ArcGIS Online?
    – Mox
    Commented Jan 9, 2023 at 17:14

4 Answers 4

4

It is possible to do using Arcade expressions. See example here of a 1:M join between parcels and addresses: Residential Permit Parking

I'm not sure this is the most efficient way to accomplish this, but it works:

  1. Get the related table using FeatureSetById
  2. Use the filter function to narrow the results to the rows you are interested in.
  3. Use a for loop to interate through the feature set. This is where you can format the data to print however you would like.
//Get related table
var ineligibleAddresses = FeatureSetById($datastore, '32')

//Get related features from table
var relatedAddresses = Filter(ineligibleAddresses, 'Parcel = '+$feature.Parcel_Nbr)

//String to print
var parcelIneligible = ''

//Iterate through each row and format
for(var address in relatedAddresses) {
    parcelIneligible = parcelIneligible + address.HouseNbr + ' '
    + address.StreetDir + ' ' 
    + address.StreetName + ' '
    + address.StreetType + ' '
    + address.Note + ' '
    + TextFormatting.NewLine
}

//print related addresses
parcelIneligible
1

The web maps themselves will only display statistical information in the pop-ups when the join is one-many. Was able to get the information working in one of the templates provided by the web app builder. Given web app builder seems to be the path forward, I'll accept it as a solution.

1
  • What was the template you used? Commented Jul 20, 2018 at 16:06
1

It is possible to do this with Arcade expressions. You can see a sample expressions here.

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 = "";
if (related_data_filtered_count > 0) {
    output = "Total of " + related_data_filtered_count + " records";
    for (var relatead_data_row in related_data_filtered) {
        output += TextFormatting.NewLine + relatead_data_row.FieldName1 + " - " + relatead_data_row.FieldName2;
    }
} else {
    output = "No Related Records...";
}

return output;

Best to use a custom attribute display for the popup.

0

Not an exact solution to your posted question but a workaround for similar functionality if you are still interested...

Rather than creating a 1:m relate, you can create and calculate a field in your feature class that contains a string representation of your list of related records, separated by a delimiter.

Then, in ArcGIS Online, you can configure an attribute expression to replace the delimiter you chose with '\n', which will put each item on a new line.

(screenshot of the results)

screenshot of the results

1
  • Good idea, PAW. Can you share an example of the Arcade expression you would use for this? I'm having a hard time getting more than just the last related record name to populate the field. FYI: I'm using an attachment table, which Arcade can access.
    – Joe Bryant
    Commented Mar 24, 2021 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.