tricksbeginner

Dynamic Lookup Table Use

Learn how to use dynamic external data from versioned Lookup Tables to drive rule-based calculations in a Decision Table, ensuring the logic always references the latest active catalog version.

DecisionRules

David Škarka

Template author

This project simulates a rule system designed to calculate the final price of a product by first looking up its base price and name, and then applying a tiered discount based on that base price.

The logic is contained within a Decision Table that utilizes an external Lookup Table containing the product catalog.

Solution Components:

  • A Lookup Table named Product Codes stores the complete product catalog, including the productCode (primary key), product and price. It has two versions:

    • Version 1 (Published): The active price list currently used for all calculations.

    • Version 2 (Pending): A newer price list awaits publication.

  • A Decision Table named Product Price performs the core logic (attention: change the strategy of execution to First Match). It takes a productCode as input and performs the following:

    1. Looks up the price and product from the latest active version of the Product Codes Lookup Table.

    2. Applies a discount percentage to the base price to calculate the finalPrice based on the product's price range.

    3. Returns the product name and the calculated finalPrice.

Use this template to learn how to:

  • Reference Active Versions: How to use the LOOKUP_VALUE function with the third parameter set to 0 to automatically fetch data from the latest active version of an external Lookup Table.

  • Handle Edge Cases: How to include non-price error rows using LOOKUP_EXISTS and an ELSE condition to provide informative outputs for invalid or unlisted product codes.

Check iconA checkmark inside a circle signifying "yes"Minus iconA minus inside a circle signifying "no"PROS IconA plus symbol representing positive aspects or benefits.CONS IconA minus symbol representing negative aspects or drawbacks.

More Templates

See Other Templates

financial servicessuggested

A/B Testing

Discover a simple way to assign a test group for performing A/B Testing on your decisions.

Explore
financial servicessuggested

Risk Based Pricing

Discover a simple way to apply a suitable Risk Based Pricing matrix based on a type of client.

Explore
financial servicessuggested

Eligibility and Policy Rules

Discover a simple way to define and execute various sets of rules and get the final decision outcome.

Explore