Arcade expression does not work during online

466
5
10-25-2021 11:29 AM
KerryKang
Occasional Contributor II

Hello all,

I have encountered an error while using Arcade custom pop-ups in Field Maps. It works perfectly if I test it using Classic Map Viewer or downloaded offline maps from Field Maps, but it does not work while I am using Field Maps in online environment.

 

An Arcade expression was applied to road structure line features, and it returns ‘yes’ if the selected feature is near critical routes (within 500m).

 

var bufferDist = 500;

var nearCR = Intersects(FeatureSetByName($map,"Critical Routes"), Buffer($feature, bufferDist, "meters"));

var cnt =  Count(nearCR)

if (cnt>0){ return "yes"}

else {return "no"}

 

The same expression was used for the point layer and it works well as expected in both Map and Field Maps (online/ offline). It looks like the expression is correct so I am not sure where to look into to solve this problem. Any tips?

 

Thanks.

 

K

Tags (2)
0 Kudos
5 Replies
ChrisDunn1
Esri Contributor

Hi Kerry,

Is the expression returning an error and if so can you share it? Also, are you on iOS or Android? What version of the app are you currently running?

Chris

0 Kudos
KerryKang
Occasional Contributor II

Hi @ChrisDunn1 

It does not return an error but returns 'no' all the time while it is expected to return 'yes'. I observed this in both Android and iOS.  I am using version 21.3.1 on my iOS devices (phone and Ipad).

 

K

0 Kudos
ChrisDunn1
Esri Contributor

Hi Kerry,

If you increase the distance of the buffer to something like 2,000 meters, will you get any "yes" values? I was able to create a scenario where a point measured 400m away from a line but using your Arcade expression a "No" was returned with a 500m buffer, but a "Yes" was returned with a 1000m buffer. I will look into this further to see what is causing the discrepancy and if there is a more preferred expression to achieve what you're looking for.

0 Kudos
KerryKang
Occasional Contributor II

Hi @ChrisDunn1 

 

That's interesting. I may try to increase the buffer value but we may need to be stick with 500m eventually as it's criteria. please let me know if you find more information. Thank you!

 

Cheers,

 

Kerry

0 Kudos
DougBrowning
MVP Notable Contributor

My guess is it is timing out on you.  You are returning every field and the geometry so it could be huge depending on your service.  When offline it can grab local so it is much faster then when online.

Looks like you need the geometry but not any fields.  You can just grab one field like this.

FeatureSetByName($map,"Plots", ['ObjectID'])

I also saw this  Be aware that using $feature as input to this function will yield results only as precise as the view's scale resolution. Therefore values returned from expressions using this function may change after zooming between scales.

https://developers.arcgis.com/arcade/function-reference/geometry_functions/ 

Hope that does it.

0 Kudos