So, I've been running into an issue while designing some forms in Connect to use offline.
The forms, as currently set up, are supposed to take the "zone" you're in based on a geopoint question and then return some information about the zone.
The issue is, this doesn't work offline because @pulldata() pulls from a live service, instead of a Mobile Map Package or Mobile GDB or something or caching the information in the map.
So. My options are:
None of these are great.
So, I got to thinking.
Why not Calculation modes?
If we had a calculation mode that was "On submission", we could get the information we need when it's actually able to be retrieved automatically, without having to worry too much about making sure we get it.
Please add this functionality.
Related: Take basemap and other layers offline when using o... - Esri Community
For some reason, I thought you could use a calculate to dynamically set calculationMode, so I tried that quickly and it doesn't work.
An onSubmit parameter would be nice. Or even just let us use calculates in the bind::esri:parameters column to dynamically set calculationMode
Does setting the calculation mode in bind::esri::parameters to always not achieve this?
From the blog
'Set the calculationMode to always, and your calculation will never be suspended. It will run always, no exceptions. If the user manually resets the calculated value, as soon as any referenced variable in the calculation changes, the expression will be evaluated.The calculation will also be triggered when the form is submitted, just in case!'
I can think of a few scenarios where dynamically swapping between "auto" and "always" would be welcomed.
But a quick addendum... "Does setting the calculation mode in bind::esri::parameters to always not achieve this?" When the blog says "It will run always, no exceptions" they are wrong. There is one exception. Calculates in repeats never work unless the repeat record is active. I know this is semantics, but it comes up a lot. I have a few processes that would love "always" to affect non-active repeat records.
Does setting the calculation mode in bind::esri::parameters toalwaysnot achieve this?
So, I went out and tested it. The issue that I found is that it doesn't work in if your form was collected offline unless you re-open it prior to syncing.
That is, it counts "submission" as closing the form, whereas I was thinking of it as "sync back to the feature service" ("Send").
So it looks like there are two issues here:
@abureaux I am pretty sure you can use a calculation to change the calculationMode, I am using it in some of my surveys and it works as I expect it to (unless I'm just losing my mind and Auto just makes it look like it)
if(${ActivityCode}!='other','calculationMode=always','calculationMode=whenEmpty')
That said, I can definitely see what Alfred means, if you use a calculation that requires access to a hosted table, but you are offline, you want it to calculate that question when it submits because it means it has internet connection then. I think that makes sense, basically reviewing it actually did the calculation before it ends up in the Survey123 data table.
@RobertAnderson3I could have sworn this was possible, but when I went to set it up, it didn't function. I will try again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.