Select to view content in your preferred language

Calculation Modes: Run Calculations upon form submission

127
4
a week ago
Status: Open
Labels (2)
AlfredBaldenweck
MVP Regular Contributor

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:

  1. Make it an online workflow (doesn't work in this situation)
  2. Enter the information manually after getting back from the field
  3. Set the calculation mode to "Manual" and trust the users are going to remember it before syncing.
    1. Thinking aloud here, I suppose you could make the questions required, so you couldn't submit it otherwise? Not sure that's a great solution.
  4. Set up a scheduled task to calculate it every night or every hour or something.

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

4 Comments
abureaux

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

Andy_CS

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!'

abureaux

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.

AlfredBaldenweck

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:

  1. Disconnect in what the vocabulary means.
    1. In my mind, if you can still edit the form (Outbox and drafts), it doesn't count as submitted. Esri apparently feels differently on this.
  2. More to the point, I need a way to run the calculation when the form actually gets synced to the feature service ("Send") that does not require the user to open up each form to get that calculation to run prior to syncing. 
    1. Especially since it seems like you can either send your entire Outbox or nothing, so if you have multiple forms you have to open up to get this calculation to run, you're out of luck