Select to view content in your preferred language

Autopopulate Site Name from Geofence in Another Feature

546
3
06-10-2024 01:23 PM
LeviCecil
Frequent Contributor

I'm setting up an incident reporting app for our security department. We'll be logging incidents at schools as points. We have geofences around each school, and we'd like to be able to auto populate the school name from the geofence in the school name field in the incident point that's being created within that geofence. Would I be able to accomplish this with an Arcade expression?

0 Kudos
3 Replies
ChrisDunn1
Esri Contributor

Hi @LeviCecil,

That workflow is very possible using a calculated expression in a smart form and Arcade.

Check out the first example in this blog post for guidance on how to do it: https://www.esri.com/arcgis-blog/products/field-maps/field-mobility/common-calculated-expressions-fo...

I hope that helps!

Chris

0 Kudos
LeviCecil
Frequent Contributor

Ah great! Thank you! 

0 Kudos
LeviCecil
Frequent Contributor

Hi Chris, I've revisited this and it's working. The problem I'm running into is that I want the field to still be editable if someone is making a report and they aren't in the site's geofence in Field Maps. Is there a way to make it calculated, but also editable? 

arcade.PNG

Here is my expression 

var geofence = FeatureSetByName($map, "Security_Geofences",['Site'])

var site = First(Intersects($feature, geofence))

if (!IsEmpty(site)) {
    return site['Site']
} else {
    return null
}
0 Kudos