Derived Fields making calculations from framework handles in a unified display
This probably borders on what is currently supported in formulize using frameworks, so I want to be clear that I don't think I am reporting a "bug" but just some erroneous behavior when trying to implement something that seems like it should work but might not be fully supported.
Description:
I have a form with two calculated fields. Let's say "total amount" and "balance"
The total amount is a rather complex calculation that depends on addition and multiplication of values in 2 separate tables linked to the main form in a 1:1 relationship.
The "balance" is calculated from the total amount - the sum of a series of payments from another linked form that has a 1:many relationship to the main form.
Behavior:
If I view the form by passing through the menu first where I get a list of 10 items per page at a time the calculations work perfectly.
If I view an individual item and then save. The formulas don't work.
Formulize seems to make these calculations a few different ways.
1) at the time a form is loaded in form view it will calculate derived values in the form for all items on the viewable page
2) if you export all table values, it will calculate all values in the form at that time
3) derived formulas are run at the time an individual record is saved. This is when it does not work for me.
Any suggestions?
BTW ... It order for method 1 and 2 above to work, it also seems that I have to NULL out all the derived fields in advance using either cli sql or phpmyadmin.


Comments
Curious, need to narrow this down a bit
Hello,
Derived value formulas should be able to make reference to fields in other forms if you're using a framework, and it should work OK regardless of whether you're listing entries or editing one.
If you have a derived value formula that is written to work with a framework, but then you do something with the form directly, then the formula will fail, because the fields it is referencing won't be available.
So maybe that's what's going on here? But it's not clear to me that's the case.
Also, when testing/debugging derived value formulas, it is useful to put this parameter in the URL when you first go to the page:
&forceDerivedValueUpdate=1
That will cause all formulas to be updated all the time (normally they are only updated when you save an entry).
I am describing the behaviour in 3.1 and later. In 3.0, it was a bit different.
It is possible that there's something unique about the way your framework is defined, which is causing a problem here. I suspect the only way I could tell for sure is to examine the issue as it happens, since it's no doubt tied heavily to your specific configuration options, so replicating would be difficult. Pass on the login credentials via e-mail if you would like more specific help.
--Julian