Magic User Group

Magic Wiki-Wakka : IUCompleteMechanism

HomePage :: CATEGORIES | Index :: Changes :: Comments :: Search :: Login/Register

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.
image
Example:

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:
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]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki trunk
Page was generated in 0.0581 seconds