CalculationMode

2708
7
Jump to solution
03-02-2022 04:10 PM
AdriannaBarton
New Contributor III

With the new 3.14 release I have read that calculationMode is now a usable parameter. However, I cannot find any example documentation eanywhere on this , and after trying it in my forms it doe not appear to be working. In the esri::bind:parameters column  I am putting: calculationMode=auto

Is that the correct syntax? What is the default calculationMode when no mode is entered?

Attached is the most detailed description I have found but no examples are included in that description.

1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Hi @AdriannaBarton,

Thanks for pointing out the oversight in the documentation, we will have that fixed for the next update. The calculationMode actually applies to the first calculation, as well as subsequent recalculations. Therefore if you use manual, no calculation will be run the first time, until the button is pressed. The explanation of this was correct in the blog post, just not in the online documentation:

What's new in ArcGIS Survey123 (February 2022) - Esri Community

As for the issue you are seeing with your sum() calculation in the repeat, this is expected. It actually was not working correctly before, and values were not being updated when they should have been in 3.13 or earlier, a bug we fixed.

If you use a reference in a calculation to a field inside the same repeat, for a value that comes from the repeat or other records in that same repeat, the sum() will update after new values are added to other records. The best way to do what you are wanting, it to use position(..) and/or indexed-repeat() functions, to ensure the value is only updated once and for that current repeat record you are on. You can also use the once() function in combination to ensure it only runs once also. See below documentation:

https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformrepeats.htm#ESRI_SECTION1_9F07ECB9...

If you search the forums there are many users also doing something similar to what you are after, and have successfully used position(..), indexed-repeat() and once() to achieve this across repeats.

Regards,

Phil.

View solution in original post

0 Kudos
7 Replies
by Anonymous User
Not applicable

Hi @AdriannaBarton,

Documentation for calculationMode can be found here:

https://doc.arcgis.com/en/survey123/desktop/create-surveys/prepopulateanswers.htm#ESRI_SECTION1_FC29...

Auto is the default when not specified. Using calculationMode=auto will not make any difference to not using it at all, as it will be same behavior in 3.13 and 3.14, where we auto applies rules to work out if the calculation should be run.

Always and manual will provide the additional functionality not possible before in 3.13.

Regards,

Phil.

0 Kudos
AdriannaBarton
New Contributor III

thank you for your response Phil. The link provided is not working:(

0 Kudos
by Anonymous User
Not applicable

Hi @AdriannaBarton.,

Sorry about that. I accidently pasted the dev link to our internal doc site. I have updated the link above to the public doc site.

Regards,

Phil.

0 Kudos
AdriannaBarton
New Contributor III

Thanks Phil!

Another question about these calculationModes- all of the documentation says these should only effect a recalcuations - so a calculation with the manual setting should be calculating once, correct? And only recalculating when the button is pressed?

 

I have a new issue within a repeat where I am creating a serial # for each repeat. This is how we have had it working perfectly before the update. It seems fine when I add 2+ repeats, but if I go back to the first repeat, the PHOTOS_Serial calculation is re-running, I put calculationMode=manual in the esri::bind:parameters  for this fields and then it doesn't run whatsoever. I have attached the calculations I have and the fields. Please let me know why this isn't working. Thank you!

0 Kudos
AdriannaBarton
New Contributor III

Here is an image of what happens if I take 3 images and return to the first one. All of the serial #'s become the highest value. 

0 Kudos
by Anonymous User
Not applicable

Hi @AdriannaBarton,

Thanks for pointing out the oversight in the documentation, we will have that fixed for the next update. The calculationMode actually applies to the first calculation, as well as subsequent recalculations. Therefore if you use manual, no calculation will be run the first time, until the button is pressed. The explanation of this was correct in the blog post, just not in the online documentation:

What's new in ArcGIS Survey123 (February 2022) - Esri Community

As for the issue you are seeing with your sum() calculation in the repeat, this is expected. It actually was not working correctly before, and values were not being updated when they should have been in 3.13 or earlier, a bug we fixed.

If you use a reference in a calculation to a field inside the same repeat, for a value that comes from the repeat or other records in that same repeat, the sum() will update after new values are added to other records. The best way to do what you are wanting, it to use position(..) and/or indexed-repeat() functions, to ensure the value is only updated once and for that current repeat record you are on. You can also use the once() function in combination to ensure it only runs once also. See below documentation:

https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformrepeats.htm#ESRI_SECTION1_9F07ECB9...

If you search the forums there are many users also doing something similar to what you are after, and have successfully used position(..), indexed-repeat() and once() to achieve this across repeats.

Regards,

Phil.

0 Kudos
AdriannaBarton
New Contributor III

Thank you Phil! The position(..) worked like a charm. I appreciate the help!