I have a form with many calculated values.
At the end of my form, there is a last calculated value which is calculated from the previous ones.
When user fills out the form the first time, no prob, it's working fine.
But sometimes when opening it for an edit, the calculated values are not calculated in the right order so the final value is wrong. It makes my users disappointed about this.
They have to reload the page until it gets right.
Is there a way to tell the system in which order should the calculated value should be calculated ?
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.
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.
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
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?