User Interaction

Requirements and solution

This is a classic example of a multi-table transaction. The client (perhaps a user interface, perhaps a message) updates a Purchaseorder as isReady = true. As in a shopping cart checkout, the diagram below depicts that business logic is required to...

Adjust the Customer balance, and

Adjust the Product quantity

The subsections below illustrate the solution.

Increase Customer Balance

A Customers balance does not reflect the Orders Amount until the
Order is marked "ready" (analogous to a shopping cart checkout). Our
requirement is to specify logic to make this happen.

Forward Chaining

This example is an excellent illustration of the power of Forward Chaining: analogous to a spreadsheet, the logic engine automates change propagation to all dependent (referencing) data. Significantly, this includes multi-table references as illustrated below.

Adjustment logic is a 1-row update, instead of retrieving all the child data

Logic Logging

The BusLogicIntro test buslogicintrotest/orderentry/update/Purchaseorder_update_makeReady_test provides a good example of a typical transaction. We are setting the isReady flag to true in aPurchaseorder valued at $50 with 2 Lineitems (1 ProductId=1 @ $10, and 2 ProductId=2 @ 20).