I'm still quite new to using arcade expressions. Im building a hydrant flush log form. I want certain fields such as Hydrant ID and address to automatically be filled in from the related layer. I'm using this expression but i'm not fully understanding it. What is it that i need to change?
// Get the feature set for the hydrants
var hydrants = FeatureSetByRelationshipName($feature, 'wHydrant', ['facilityid'], true)
// Get the first hydrant (should only be one)
var hydrant = First(hydrants)
// If there was a hydrant, return the facilityid of it,
// Otherwise, return null
if (!IsEmpty(hydrant)) {
return hydrant['facilityid']
} else {
return null
}