Select to view content in your preferred language

related table for popup arcade exp not working

502
1
01-31-2023 12:03 AM
Labels (3)
ChiragTiwari76
New Contributor

// Acess 'Groundwater Levels Monthly Mean' table as a FeatureSet
var portal = Portal("https://fis-ocha.maps.arcgis.com/")
var cities = FeatureSetByPortalItem(portal,
"0218468f0d8f40daa9b5aa79b88ca961", 1, ['admin4_en2',
'primary_destination', 'parentglobalid'])

// Filter related features by using a common attribute
var globalid = $feature.globalid
var filterStatement = 'parentglobalid = @globalid'

// Related features as a variable
var relatedData = Filter(cities, filterStatement)


// Build the pop-up string by iterating through all related features
var popupString = ''
for (var f in relatedData){

popupString +=

"Secondary City: " +
DefaultValue(f.admin4_en2, 'no data')
}


return popupString

 

0 Kudos
1 Reply
JohannesLindner
MVP Frequent Contributor
  • To access AGOL, use the url https://www.arcgis.com
  • Don't use reserved names (Portal) as variable names. It's no problem here because you don't need to call Portal() anymore, but you could run into prroblems with other expressions if you let that become a habit.
var p = Portal("https://www.arcgis.com")
var cities = FeatureSetByPortalItem(p, "0218468f0d8f40daa9b5aa79b88ca961", 1, ['admin4_en2', 'primary_destination', 'parentglobalid'])

Have a great day!
Johannes
0 Kudos