Obtaining Record Attributes from a Hosted Table to Display in Feature Layer Pop-up with Arcade Expression

04-01-2023 12:42 AM
Labels (3)
New Contributor

I'm having trouble figuring out how to retrieve a field from a standalone hosted table and show it in the pop-up of a hosted feature layer. Can anyone assist?

Data Item Overview:
exemplar_list_testing (hosted feature layer)




exemplar_publication_testing (hosted table)



I aim to display the 'paragraph_description' field in the feature layer pop-up from the hosted table.

Current Arcade Expression:


var ExemplarListID = $feature.UniqueID;
var ExemplarPublicationGID = "ExemplarListID = @ExemplarListID";

var ExemplarPublications = FeatureSetByName($map, "exemplar_publication_testing");
var RelatedData = Filter(ExemplarPublications, ExemplarPublicationGID);

var popupstring = "";
for (var ExemplarPublication in RelatedData){
    popupstring += "Paragraph Description:  " + ExemplarPublication.Paragraph_Description + TextFormatting.NewLine;
popupstring += TextFormatting.NewLine;

return popupstring;





Tags (3)
0 Kudos
4 Replies
Regular Contributor

There is an issue with the expression in the second line:

var ExemplarPublicationGID = "ExemplarListID = @ExemplarListID";

This line is setting the variable ExemplarPublicationGID to a string, which contains the literal text "ExemplarListID = @ExemplarListID". This is not a valid Arcade expression and will not evaluate correctly.

Instead, the expression should reference the variable ExemplarListID directly, like this:

var ExemplarPublicationGID = "ExemplarListID = '" + ExemplarListID + "'";

This sets ExemplarPublicationGID to a string that contains the value of ExemplarListID, enclosed in single quotes. This will allow the expression to be used as a filter in the Filter function.

0 Kudos
MVP Esteemed Contributor

You can use variable substitution (see the Filter help) like that, shown here:


0 Kudos
MVP Esteemed Contributor

There is no ExemplarListID field in the exemplar_publication_testing table. Your sql expression should be

var ExemplarPublicationGID = "UniqueID = @ExemplarListID";
0 Kudos
Regular Contributor

var ExemplarPublicationGID = "UniqueID= '" + ExemplarListID + "'";

0 Kudos