Hello, I am new to field maps but have came across an issue that I am wondering if anyone else is having or would be a good feature request. I have two layers.. one is a master copy and one is an inspection layer. I am trying to pull information from the master file to populate my inspection (i.e. AssetID, AssetType). In some case, it is possible the AssetType is wrong, so I would like to be able to edit this feature. However the arcade expression only returns a "read only" field. My calculated expression is below by the way. If it does not paste correctly, I got it from this document. Its expression number 7 "Store information from a nearby feature" https://www.esri.com/arcgis-blog/products/field-maps/field-mobility/common-calculated-expressions-for-arcgis-field-maps/
I know that I can just edit the master file to reflect this change and pull the correct information, but I think this could be verified in real time in the field if the returned AssetType was not a read-only attribute. Instead there is an extra step of having to manually edit the data. Wondering if anyone else has had this issue?
// If feature doesn't have geometry return null
if (IsEmpty(Geometry($feature))) { return null }
// Get the parcels layer
var parcels = FeatureSetByName($map, 'Parcels')
// Buffer the current location and intersect with parcels
var bufferedLocation = Buffer($feature, 100, 'feet')
var candidateParcels = Intersects(parcels, bufferedLocation)
// Calculate the distance between the parcel and the current location
// Store the feature and distance as a dictionary and push it into an array
var featuresWithDistances = []
for (var f in candidateParcels) {
Push(featuresWithDistances,
{
'distance': Distance($feature, f, 'feet'),
'feature': f
}
)
}
// Sort the candidate parcels by distance using a custom function
function sortByDistance(a, b) {
return a['distance'] - b['distance']
}
var sorted = Sort(featuresWithDistances, sortByDistance)
// Get the closest feature
var closestFeatureWithDistance = First(sorted)
// If there was no feature, return null
if (IsEmpty(closestFeatureWithDistance)) { return null }
// Return the address
return `${closestFeatureWithDistance['feature']['ADDNUM']}