I have a feature layer that has points representing range improvement feature and a related table (1:M) that stores inspection records of those range improvements. I would like to return the last inspection date recorded in the inspection table for those features as an attribute in the pop-up of the range improvement point in the Field Maps app.
I am able to do this successfully in a web map using the Arcade expression below. However when I click on features live in Field Maps I am only half successful. For features without inspection records the expression will return "No inspection records found" to the pop-up, but for features with related inspection records I se only a "-" rather than the date I see when I look at the pop-up in a web map.
var sql = "range_imp_guid = '"+$feature.GlobalID+"'";
var tbl = Filter(FeatureSetByName($map,"Point Inspection"), sql);
var cnt = Count(tbl);
var lastinsp = "";
if (cnt > 0) {
var tbl_ord = OrderBy(tbl, 'last_insp_date DES');
var info = First(tbl_ord);
lastinsp = Text((info.last_insp_date), "MM-DD-Y");
}
else {
lastinsp = "No inspection records found"
}
return lastinsp;