Hello,
I have a feature service of tree points with a related table of inspections (1:M). I would like the pop-up to display the inspection date for those trees that have been inspected (related table field: Inspected_Date) .
The FeatureLayer/RelatedTable relationship is based on GlobalID/GUID but there is also matching data in the UNIQUE_ID/Unique_ID fields.
I have an Arcade expression that correctly returns 'No inspections' for those trees that have not been inspected. For the trees that have been inspected, the expression returns the same date '5/23/2022' for all trees instead of the actual inspection date.
What do I need to tweak to make it work?
var tbl = FeatureSetByName($datastore,"CALFIRE_UrbanForestry_Inspections", ['Unique_ID', 'Inspection_Date'])
var uniqueid = $feature["Unique_ID"]
var sql = "UNIQUE_ID = @uniqueid"
Console(sql)
var inspections = Filter(tbl, sql)
var cnt = Count(inspections)
var history = ""
if (cnt > 0) {
history = "inspections: " + cnt
for (var inspections in tbl) {
var insp_date = Text(inspections.Inspection_Date, 'MM/DD/YYYY')
history = "Inspected: " + insp_date
}
} else {
history = "No inspections"
}
return history
All help is greatly appreciated,
Francesca