Using Lookup Tables in Rules

Lookup Tables become truly powerful when integrated with other rule types. This section explains how to query Lookup Tables from Decision Tables, Decision Trees, Flows, and Scripting Rules.

Overview

Lookup Tables provide reference data that your rules can query during evaluation. Instead of hardcoding values in your decision logic, you can:

  • Store data centrally in a Lookup Table

  • Query the table dynamically based on input values

  • Keep your rules clean and your data maintainable

LOOKUP Functions

LOOKUP_VALUE

The primary way to query a Lookup Table is using the LOOKUP_VALUE function available in Decision Tables, Decision Trees and assorted Flow nodes (e.g. Assign, Global Variable, etc...).

Syntax

LOOKUP_VALUE(rule-alias, primaryKey, version?, outputColumn?)
Parameter
Description

tableAlias

The alias (or id) of the Lookup Table to query

primaryKeyValue

The value to search for in the primary key column

version

The version of the Lookup Table to query (latest published version is used when omitted)

outputColumn

The name of the column to return. When omitted the entire row is returned as an object

Return Value

  • Returns the row or the value from the specified column where the primary key matches

  • Returns null if no matching row is found

  • Returns null if the column doesn't exist

Example

Given a Lookup Table with alias product-catalog:

product_code (PK)
product_name
price
category

SKU-001

Widget Pro

29.99

Electronics

SKU-002

Gadget Plus

49.99

Electronics

Query:

With input {productCode: "SKU-001"}:

  • Returns: 29.99

With input {productCode: "INVALID"}:

  • Returns: null

LOOKUP_EXISTS

Returns a boolean (true/false) depending on if the entered primary key is present in the queried Lookup Table

Syntax

Parameter
Description

tableAlias

The alias (or id) of the Lookup Table to query

primaryKeyValue

The value to search for in the primary key column

version

The version of the Lookup Table to query (latest published version is used when omitted)

Return Value

  • Returns boolean

  • Returns true if a row exists with the queried PK

  • Returns false if no matching row (PK value) is found

Example

Given a Lookup Table with alias product-catalog:

product_code (PK)
product_name
price
category

SKU-001

Widget Pro

29.99

Electronics

SKU-002

Gadget Plus

49.99

Electronics

Query:

With input {productCode: "SKU-001"}:

  • Returns: true

With input {productCode: "SKU-055"}:

  • Returns: false


Integration with Decision Tables and Trees

Using LOOKUP functions in Conditions and Results

You can use both LOOKUP functions in condition, calculation or result columns of a Decision Table or branches of a Decision Tree

Using Lookup Tables with Valid Values

Lookup Tables can serve as a data source for Valid Values in Decision Table columns. This allows you to restrict cell entries to values from a Lookup Table, ensuring data consistency and reducing input errors.

Setting Up a Lookup Table Reference

  1. Open your Decision Table in the Table Designer

  2. Click the dropdown arrow in the column header

  3. Select Valid Values

  4. Choose Lookup Table Reference

  5. Select the Lookup Table and the column to use as the value source

Once configured, each cell in the column displays a dropdown with values from the referenced Lookup Table.

Display Values

You can configure a display value to show a more readable label in the dropdown while storing a different value in the cell. This is useful when you want to select by one attribute but store another.

Example: Display product names in the dropdown, but store the product code when selected.

Display values make it easier to work with technical identifiers like codes or IDs by showing human-readable labels during selection.


Integration with Decision Flows

In Decision Flows, you can use the Business Rule node to call the Lookup Table directly.

Or use the afformentioned LOOKUP_VALUE and LOOKUP_EXISTS functions in any Flow node that supports it. (e.g.: Assign, Declare, Global Variable, etc...)


Integration with Scripting Rules

No special Lookup function is yet implemented in Scripting Rules or Custom Code nodes of a Flow. Please use DR.Solve() to call Lookup tables in these cases.


Best Practices

Use Meaningful Aliases

Choose clear, descriptive aliases for your Lookup Tables:

Consider Performance

Performance Optimization: When you query the same Lookup Table multiple times within a single rule evaluation — such as in a loop or across multiple conditions in a Decision Table — the table is automatically cached. This means each subsequent lookup is extremely fast, so feel free to use multiple LOOKUP calls without concern for performance.


Common Patterns

Pattern 1: Product Enrichment

Enrich order data with product information:

Pattern 2: Tiered Pricing

Apply different pricing based on customer tier:

Pattern 3: Geographic Configuration

Retrieve settings based on location:

Pattern 4: Feature Flags

Control features based on configuration:

Last updated