Have you ever wanted to automatically populate attribute information into new feature to save time and mitigate mistakes? It's possible with calculated expressions in ArcGIS Field Maps! This video was recorded using ArcGIS Field Maps in August 2022. For more information about common calculated expressions and examples, click here.
For further field data management training, check out Esri's Field Data Collection and Management Using ArcGIS course: https://bit.ly/3EyRgd0
Here is some similar code you can copy and paste:
// 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
}