I have the arcade pop-up expression written (see below). The pop-up displays correctly in ArcGIS Online and in Field Maps. However, Collector returns a dash ("-"). I've reviewed a number of tutorials and Esri Community posts, but none seem to apply here.
Expression 1
//Access 'Hydrant Inspections' table as a FeaureSet
var inspections = (FeatureSetByName($datastore,"Inspections"))
//Filter related features by using a common attribute
var UID = $feature.UID
var filterStatement = 'UID = @UID'
//Related features as a variable
var relatedData = Filter(inspections, filterStatement)
//Sort related features from oldest to newest
var relatedDataSorted = OrderBy(relatedData, 'InspectionDate ASC')
//Build the pop-up string by iterating through all related features
var popupString = ''
for (var f in relatedDataSorted){
popupString +=
Text(f.InspectionDate, 'MMMM D, Y')
+ TextFormatting.NewLine +
'Box Condition: ' +
f.Condition + TextFormatting.NewLine +
'Notes: ' +
f.Notes + TextFormatting.NewLine +
TextFormatting.NewLine
}
return popupString
I've also tried simpler expressions and get the same result. The bellow expression works in AGO and Field Maps, but not in Collector.
Expression 2
//Related features as a variable
var relatedData = FeatureSetByName($map,"Inspections")
var popupString = ''
//Add all inspection dates to a pop-up string
for (var row in relatedData){
if ($feature.UID == row.UID) {
popupString += Text(row.InspectionDate, 'MMMM D, Y')
}
}
return popupString
EDIT
Some additional info. The above was all edited in the new Map Viewer. I tried authoring a new map in Map Viewer Classic and copied both of the above expressions. Expression 1 works in AGO and Field Maps, but not in Collector. However, Expression 2 only works in Field Maps. AGO returns a blank (" ") and Collector returns a dash ("-").