I've written an Arcade expression for a layer's popup in the new map viewer, based on records from a related table. The expression returns the expected text, but the layer's popup is empty.
Adding a new Arcade expression with the default code works:
return {
type : 'text',
text : 'place your text or html here' //this property supports html tags
}
The layer and the related table both have popups enabled and all fields are visible. So what am I doing wrong?
This is the code:
var dossiers = FeatureSetById($datastore, "4")
// Filter related features by using a common attribute
var CD = $feature.Code
var filterStatement = "domeinnummer = @CD"
// Related features as a variable
var relatedData = Filter(dossiers, filterStatement)
// Sort related features by oldest to newest
var relatedDataSorted = OrderBy(relatedData, 'Dossiernummer ASC')
// Build the pop-up string by iterating through all related features
var popupString = "Domein " + $feature.Domein
for (var f in relatedDataSorted){
popupString += TextFormatting.NewLine + DefaultValue(Text(f.Dossiernummer), 'geen nr') + " - " + DefaultValue(f.Naam_OVAM_Dossier, 'geen naam')
+ TextFormatting.NewLine + " " + DefaultValue(f.Expert_Status, 'geen status')
}
DefaultValue(popupString, 'Geen dossier')