Select to view content in your preferred language

Provide documentation on Arcade evaluation in Field Maps vs Map Viewer

186
5
a week ago
Status: Open
Labels (1)
BlakeMorrison
Frequent Contributor

I've been in contact with Tech Support and we've discovered that there is no documentation regarding the difference in how Arcade is evaluated between Field Maps and Map Viewer.

 

It was suggested to me that the more people upvote the idea of documentation, the more likely Esri is to provide it.

5 Comments
LindsayRaabe_FPCWA

Yes! And I wish that the Arcade windows woudn't give you functions that aren't compatible in Field Maps when you're writing the code in Field Maps Designer, or at least highlighted when a selected function won't work in Field Maps. 

ChrisDunn1

Hi @BlakeMorrison ,

What sort of differences are you seeing? There are a few specific ways where Field Maps and the Map Viewer/Designer differentiate but for the most part they should be virtually identical.

In general the differences come down to three things:

- Support for new functions. Field Maps is built on the ArcGIS Maps SDK, which doesn't always support the newest Arcade functions. There is a version matrix available here. Field Maps is typically one or two versions behind, currently it supports functions up to Arcade 1.35.

- Form calculations. In complex forms that involve a lot of fields, multiple calculations, and functions that call things like Random() or Now(), Field Maps needs to evaluate the calculations in a less declarative way than the map viewer, so it can take longer or get locked into logical loops. Improvements will be coming in this area in a future release.

- Bugs. There are sometimes bugs in how Arcade is treated in Field Maps or the Maps SDK when compared to the map viewer. If you run into anything that does not seem correct we do want to hear about it, either through a support ticket or [email protected].

If there is a specific scenario you are trying to work through please let us know.

Chris

BlakeMorrison

I want documentation on the parts that are different. You (esri) seem to be aware of them. Can we have documentation for the product, please? I shouldn't have to define your product before you will.

When I share Arcade with a colleague, I shouldn't have to tell them "Esri's products evaluate differently, that's why the Arcade appears over-written. I can't give you any specifics, nor can Esri. Good luck!"

Map Viewer evaluates on clicking out of a text input, I think. Field Maps is always evaluating. I think that's the main problem I have.

I dont think this problem has anything to do with Profiles, but for what it's worth that matrix is so confusing as to be next to useless.

You say Field Maps uses "ArcGIS Maps SDK" there's two versions of that on the pages you linked, as well as Field Maps itself. This is not clarification. This is how confusion is caused. I was under the impression Field Maps specifically did not use ArcGIS Maps SDK.

 

EDIT: I think the following is what I want documentation on. It's not complex forms though. It's very basic and simple stuff that doesn't translate.

"- Form calculations. In complex forms that involve a lot of fields, multiple calculations, and functions that call things like Random() or Now(), Field Maps needs to evaluate the calculations in a less declarative way than the map viewer, so it can take longer or get locked into logical loops. Improvements will be coming in this area in a future release."

BlakeMorrison

Just following up, with hopefully a better tone:

  • I believe it's the difference in having to account for when the arcade is actively running/evaluating
  • As well as potentially the slight profile differences in how certain functions operate (maybe?) eg. GetUser(). I'm not up to understanding the profiles concept in enough detail and what applies to Field Maps specifically to verify this one - that's maybe my bad.
ChrisDunn1

Hi @BlakeMorrison ,

You are correct that there is a difference between Field Maps and the map viewer in how arcade is executed - in web-based clients (map viewer, web editor, instant apps, etc), the arcade calculations don't happen until you move out of the field, while on mobile they happen after you stop typing for a short time. I can see where this could cause some frustration when it's unexpected, but are there scenarios where it affects the result of the calculation or gets in the way of workflows?

If it comes down to the arcade in the form taking a long time to run repeatedly as values are being entered, there will be improvements coming in arcade efficiency in forms soon. In the meantime, one thing I've heard of people doing is adding a field called something like "calc_expressions" and set it as a switch or toggle with just yes or no values and default it to no. Then add conditions to your expressions so they only run when that value is yes. That way a user can enter the data they need to and then hit the switch to calculate everything when they're ready. It might seem a little hacky or add some complexity, but it should work to speed things up if I'm understanding your scenario correctly.

For GetUser, the difference actually comes down to whether or not you're using it in a connected or disconnected environment. Since web apps are always connected, you can access the full dictionary of values that are returned with GetUser. In Field Maps, if you are in an offline map and a disconnected environment, only the username is available when offline. This is a known difference that, you're right, may not be clearly documented outside of some other Community posts, so we can look at making that more clear.

Also, just to hit a few other things that were brought up, you are correct that Profiles aren't something you need to worry about here, they should be mostly invisible for non-developers and all you need to remember is that some things won't be available in different profiles (like featureSets in the label profile). Similarly, if you find yourself needing to reference the version matrix, Field Maps is built on the Maps SDK for Native Apps while the Map Viewer and other web apps are built on the Maps SDK for javascript. That should also be mostly invisible if you're not a developer, it's safe to assume all arcade functions should work in Field Maps unless they're from the very latest version.

I hope some of that helps!

Chris