A FeatureSet doesn't have attributes, it has Features. All you need is some way to grab an individual feature from the FeatureSet.
The simplest way to do that is with the First function. Once you get your feature, you can access its attributes the way you want.
Also, it can help keep your expression clear and easy to understand by using variables.
var fs = FeatureSetByName($datastore, "Hydrant Inspections")
var inspection = First(fs)
return inspection.InspectionDate
Which Feature?
When you grab the first feature in the set, how do you know which feature you're getting? And is it the one you want? Based on your post, I assume you want only inspections which apply to the hydrant you've clicked on. Additionally, if there are multiple inspections, you may only want the most recent.
To do that, we can include the functions Filter and OrderBy.
var fs = FeatureSetByName($datastore, "Hydrant Inspections")
var ID = $feature.hydrantID // just replace with your own field name as needed
// Get inspections for clicked hydrant
var filt_fs = Filter(fs, "hydrantID = @ID")
// Order inspections with most recent first
var ordered_fs = OrderBy(filt_fs, "InspectionDate DESC")
// Return most recent inspection specific to hydrant
var inspection = First(fs)
return inspection.InspectionDate
- Josh Carlson
Kendall County GIS