Popup only shows the expression label and then no value even though the arcade expression works in the test expression window. I followed the blog about using featuresets to create a relate and add it to a popup - https://community.esri.com/community/gis/web-gis/arcgisonline/blog/2020/06/09/show-related-data-or-t... - Gee Fernando's Blog
Here is my code:
// Write a script to return a value to show in the pop-up.
var portal = Portal("https://services.wygisc.org/portal")
var speciesRelate = FeatureSetByPortalItem(portal,
"6a0c8bcd1d164d99b76f162f140212f8", 0, ['Species', 'Taxa',
'Occurrence_Potential', 'BLM_Status',
'Texas_________________Status', 'Federal_Status', 'Habitat',
'Code'])
// Filter related features by using a common attribute
var HabCode = $feature.HabCode
var codeStatement = 'Code = @HabCode'
//Related features as a variable
var relateData = Filter(speciesRelate, codeStatement)
//build popupString by iterating through all related features
var popupString = ''
for (var f in relateData){
popupString += "Species: " + Text(f.Species) + TextFormatting.NewLine +
"Taxa: " + f.Taxa + TextFormatting.NewLine +
"Occurrence Potential: " + f.Occurrence_Potential + TextFormatting.NewLine +
TextFormatting.NewLine
}
Thoughts?
Thanks,
Shawn