Complete Incremental Update Mechanism:
The example previously presented is a simple example in the sense that only one ‘Running total’ may be updated as a result of a user interaction with one detailed row. There are more sophisticated cases where up to two ‘Running Totals’ may need to be updated. In such case, the incremental logic not only needs to factor Original and Final values but also original and final ‘Running Totals’.
Example 2: Supports updating two ‘Running Totals’ in one engine cycle:
To illustrate such need and associated capability, we will add a new ‘Category’ field (Alpha 1) to the ‘List_of_Values’ table previously introduced. Now let’s say that we want accumulate many ‘Running totals’, one for each category in the following separate table:
Table Name: Category Totals
Columns:
1) Category Code: Alpha (1)
2) Running Total: Numeric (7)
The running total must be maintained and saved as the running total of all the rows assigned to the associated category.
Index: By Category Code (Unique)
The logic to perform in this context is very similar to what was presented to maintain one overall ‘Running Total’. However there is an additional consideration. In modify mode, It must also consider and factor the fact that the ‘Category Code’ of a detailed row can be modified and furthermore can be modified together with the ‘Value’ on this detailed row.
To factor this possibility of a change of ‘Category Code’, the modify mode incremental logic must be slightly enhanced as follow:
Upon modifying the value on an existing line, the engine will perform the following to updates:
1) Reduce the original Category ‘Running Total’ (of the ‘Category Totals’ table) by the original Value.
2) Increase the final Category ‘Running Total’ (of the ‘Category Totals’ table) by the final value.

Example:
- Coming back on a line with Category (1) and value (20), modifying the Category to become (2) and the value to become (10), the engine will do the following:
- Reduce the Category (1) original Running Total by the original value of 20.
- Increase the Category (2) final Running Total by the final value of 10.
Notice that two separate rows were updated as a result of the above.
Adding the accumulation logic in our eDeveloper task example, can be done with the following:
1) Add the ‘Category Code’ column added to the ‘List_of_Values’ table to the Data View and form.
2) Add one (but only one) Link Write to the ‘Category Totals’ table after the above ‘Category Code’.
3) In the above Link:
- Locate Init:, From: and to: the ‘Category Code’ of the ‘List_of_Values’
- Select the ‘Running Total’ column.
4) In the Record Suffix, after the update of the overall ‘Running Total’ add the following:
Update, Running Total (of Category Totals), Exp=Value, How=Incr
At this point it is preferable to manually delete (from a <Ctrl+G>) all the rows from the ‘List_of_Values’ table before executing the program. This will avoid the creation of a blank ‘Category Code’ row building up a negative ‘Running Total’ value as you assign Categories currently set to blank.
You can now run the program and experience how the incremental fields are all being updated as you assign or modify categories values to each detail.
Notice that only one ‘Link Write’ operation in the Data View and one associated new ‘Update Incremental’ operation in the ‘Record Suffix’ is sufficient to handle all possible scenarios.
Back To:
Incremental Update
The original version of this page was provided by: InformaPlus
There are no comments on this page. [Add comment]