On the Compensation Plan detail page, there are two buttons to recalculate the document. The difference is in how many lines are calculated.
-
Recalculate – Recalculates all line items.
-
Recalculate Changes – Recalculates only the line items which have changed compared to the previously calculated version. (Note that the button is in the line item’s panel with input parameters.)
A change of a line is, for example:
-
Change of item’s input field
-
Change of item’s label
-
Change of item’s result override
-
Change of header input field
A line item has the field dirty
which is set by the system to true for each line which should be recalculated.
-
So for "full" recalculation, all items will be marked dirty.
-
For Recalculate Changes, only lines with some changes
If you want, you can read the value of the item’s dirty
field in the header logic’s post-phase, and do only processing of the recalculated items.
The process involves the following actions:
-
The system executes the header logic in pre-phase mode. Such code can create input fields on the header and modify the structure of the document (e.g. create/delete/update line items and folder).
-
For every item:
-
The system executes the compensation logic (only elements from the group compensation) in the standard mode. This logic will calculate and provide the results.
-
The system will store those results to the line item.
-
-
The system executes the header logic again, but in the post-phase mode. Such code can calculate summarized results of the whole document and store the results to the header (or to line items).