Select to view content in your preferred language

Arcade in Field Maps Forms

457
3
07-31-2023 05:33 PM
Labels (2)
MappingMoose
New Contributor II

Hey Community,

I've been trying to use Arcade to run some calculations in forms on ArcGIS Online.

I'm using the Contains function in a script to determine if the current feature is contained within the polygon of another layer - very similar to an example seen in Dev Summit where they run a script to determine which land parcel the tree is inside.

Issue is, this works fine in testing, works when making new points in Map Viewer, but when I make a new point in Field Maps I just get the red 'failed to calculate' message, and the form won't submit at all despite this not being a required question.

I know previously there have been issues with FeatureSet functions being used in Field Maps, but this seems to have been resolved because they were using FeatureSetById in Field Maps in the Dev Summit video I was referencing. 

Does anyone know if there's maybe a document of functions that don't work in Field Maps? I've done a bit of digging but can't find anything comprehensive or recent.

Here is the link to the video I have mentioned: Using Arcade with ArcGIS Field Apps - YouTube

Timestamp: 35:18

EDIT: Here is my script in case anyone can help

var bushfire_risk = Contains(FeatureSetById($map, "Low Bushfire Risk Area"), $feature)

if (bushfire_risk == 'true') {
return "LBRA"
}
else {
return "HBRA"
}
3 Replies
KenBuja
MVP Esteemed Contributor

Can you post your script? And is there a reason you're using Contains instead of Intersects?

ArmstKP
Regular Contributor

@KenBuja @MappingMoose Using Intersects would be a better idea.  I agree with Ken, post your script then we can diagnose.

 

MappingMoose
New Contributor II

I've just added my script to my original post, hopefully there's just some error in that which can be fixed.

Yes, I am using Contains because it was brought to my attention that if I use Intersects instead, a fieldworker could create a polyline feature (these features need to be polyline rather than point), and if this feature is partially on a low risk area, it will be returned as the feature being in a low risk area - even when part of it might actually be outside of that (high risk).

This would pose issues, and it would be really handy if I had a layer of high risk rather than low risk but I don't have access to that at this time and I don't really want to go to the effort of making another layer and then relying on my own data to be the source of truth etc.

0 Kudos