Bill Of Materials Price Rollup

In a Bill of Materials, Products may be "kits": composed of other products ("components"), recursively. When a component price is changed, logic is required to update the price of all the containing kits, recursively.

Requirement

Bill of Materials is a complex data model.

For more information:

The following image shows the relevant tables for this example:

Solution

The following image shows the reactive logic on the Manage, Rules, By topic tab:

API Creator processes the Price change as follows:
  1. The Price change is propagated down to the product_billofmaterials rows.
  2. This chains to derive product_billofmaterials.value.
  3. This chains to adjust the products.sum_components_value (per the sum rule).
  4. This chains to derive the products.sum_components_value. This logic is conditional on whether the product has components:
  5. Which derived by the products.count_components rule.