Hi
I am working on some code to bring across two date fields, 'lastinspdate' and 'nextinspdate' from another table.
I've adapted some really useful code (below) to get me started (thanks @JohannesLindner) but I'm struggling to do two things:
1/ limit the response to just show the two date fields
2/ to add in a filter that returns the response to the record with the 'nextinspdate' nearest in the future.
Many thanks in advance. Not a natural coder here so be kind 🙂
var ref_id = $feature["CENTRAL_AS"]
var fs = FeatureSetByName($map, "InspInspectionDates", ['central_asset_id', 'lastinspdate', 'nextinspdate'], false)
var filt = "central_asset_id = @ref_id"
var cou = First(Filter(fs, filt))
if(cou == null) { return "No inspection found" }
var attributes = Dictionary(Text(cou))["attributes"]
var popup_lines = []
for(var a in attributes) {
var line = `${a}: ${attributes[a]}`
Push(popup_lines, line)
}
return Concatenate(popup_lines, TextFormatting.NewLine)