For this you'll probably want to handle it with JavaScript. I would imagine the safest way to ensure that your final calculation is indeed the final calculation, you could add a calculate button which would fire a JS event that completes the calculation.
I am also finding the calculation process confusing.
I work a lot with spreadsheets so I probably have incorrect expectations but I am trying to understand when the calculation occurs on a form.
Calculate Difference Between Two Date Time Values
My situation is I have two date variables on the form (StartDate and EndDate) and want to calculate the full months between these dates.
I have created a form variable called intDaysDifference of integer type and then in the formula field I have used the runtime function dateDiffDays(StartDate, EndDate)
When I change the dates on the form (either in draft or published mode) it does not recalculate the initial value of the calculated variable.
Questions:
1. How do I get it to recalcalculate after the user enters the second date (EndDate)?
2. What is the general rule about data on a form, do calculations only run once the form has been submitted?
3. If (2) is true, does that mean I need to create a second form every time I want to use a calculated value (is there no way for the form to update dynamically as the user enters the EndDate)?
4. Does the same principle apply to variables? Form example once I select a variable on a form, can I reference that variable's setting on the same form or does that only register as the variables value once the form is submitted?
My example for Q4. is a list lookup or cascading lookup where the intiator selects variable 1 and then the approver selects variable 2 with the possible choices limited by the choice of variable 1. The filtering is based on a list I have created:
Product Group Specific Product Name
variable1a variable2a
variable1a variable2b
variable1a variable2c
variable1b variable2d
variable1b variable2e
variable1b variable2f
variable1c variable2g
variable1c variable2h
variable1c variable2i
calculated value controls recalculate automatically and immediately once any of variables/controls the formula depends on changes.
one do not have any control over it, since the order is given by their dependencies.
however, if you have a bigger form with plenty of calculations, and especially ones that depend on asynchronous functions like lookup(), userProfileLookup(), etc, it make take some time until everything get recalculated.
isn't that the case?
other problem might be if you created a circular reference. it then falls into a infinite loop where a change causes chain of recalculations, which one of them causes again to recalculate/change very first value.
by the documentantion, forms have a protection against that and after certain amount of loops it should break the recalculations, apparently some controls not having correct results.
are you able to provide an example what doesn't recalculate correctly for you?