I am trying to show in AGOL, a Dashboard, and FieldMaps pop ups the last inspection date for an outfall inspection. My crew enters in the data in a Survey123 survey from a hyperlink in FieldMaps. The data from the survey is also input into a related table. I was trying to follow along with this blog post https://community.esri.com/t5/arcgis-online-blog/show-related-data-or-tables-in-pop-ups-with-arcade/ba-p/890530
but I'm not able to figure out the "//Filter related features by using a common attribute section". I think it has to do with my GUID field relating back to the GlobalID in the parent layer. Might also be that most of the data doesn't have a related entry to it. Below is the expression I have so far:
// Access 'Groundwater Levels Monthly Mean' table as a FeatureSet
var waterLevels = FeatureSetByPortalItem(Portal('https://www.arcgis.com'),
"4b21a92f2b38444793cf1ae1192476e4", 3, ['NodeNumber', 'MajorMinor',
'DateCurrent'])
// Filter related features by using a common attribute
var globalid = $feature.globalid
var filterStatement = 'parentglobalid = @globalid'
// Related features as a variable
var relatedData = Filter(waterLevels, filterStatement)
// Sort related features by oldest to newest
var relatedDataSorted = OrderBy(relatedData, 'DateCurrent DESC')
// Build the pop-up string by iterating through all related features
var popupString = ''
for (var f in relatedDataSorted){
popupString +=
"Outfall ID: " +
DefaultValue(f.NodeNumber, 'no data') + TextFormatting.NewLine +
"Last Formal Outfall Inspection: " +
DefaultValue(f.DateCurrent, 'no data') + TextFormatting.NewLine +
"Outfall Type: " +
DefaultValue(f.MajorMinor, 'no data') + TextFormatting.NewLine +
TextFormatting.NewLine
}
DefaultValue(popupString, 'No formal inspection data to show')
I was going section by section with the expression, so this does work and returns values in the field
// Acess 'Groundwater Levels Monthly Mean' table as a FeatureSet
var waterLevels = FeatureSetByPortalItem(Portal('https://www.arcgis.com'),
"4b21a92f2b38444793cf1ae1192476e4", 3, ['DateCurrent'])
return waterLevels
It is when I try the next section where I run into issues.
Parent layer "Outfalls", showing the GlobalID for NodeNumber WOC_24OF0_00.

Child layer, "DryWeatherScreening" showing the GUID field for WOC_24OF0_00, same as the parent layer's GlobalID.

I have seen some issues of this expression not showing up in Field Maps, but I am ok with that for now.
Thanks!
Janice