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;
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.
There is no ExemplarListID field in the exemplar_publication_testing table. Your sql expression should be
var ExemplarPublicationGID = "UniqueID = @ExemplarListID";
var ExemplarPublicationGID = "UniqueID= '" + ExemplarListID + "'";