> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leapter.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Decision Tables

> Express first-match business rules as a grid of inputs and outcomes — clearer and easier to review than a long chain of nested decisions.

A **decision table** captures a set of rules as a grid: a few input columns, one or more output columns, and one row per rule. When some inputs match a row, that row's outputs are produced. It is the natural way to express a lookup — "these inputs lead to this outcome" — where a long chain of [Decision](/fundamentals/leapter-canvas/controlling-the-flow#decision) branches would hide the structure.

Because the rules sit in a table, the inputs, the outcomes, and the order they are checked are all visible at a glance — which makes a decision table much easier for a reviewer to read and verify than nested IF/ELSE logic.

## Where decision tables appear

A decision table is a type of element inside a Blueprint, shown as a grid with a table icon. You see it in both places you work with a Blueprint:

* In the **[Diagram view](/fundamentals/leapter-canvas/diagram-view)**, as a grid element in the flow.
* In the **[Specification view](/fundamentals/leapter-canvas/specification-view)**, as a table in the document.

<img src="https://mintcdn.com/leapter/s6LpHBfJjFeOR_rO/images/decision-table-node.png?fit=max&auto=format&n=s6LpHBfJjFeOR_rO&q=85&s=273848bf9b59294433e4bc95ef1e2db1" alt="A decision table element in a Blueprint — a grid mapping the riskCategory and hasCleanCreditHistory input columns to a reviewAction output column, with an arrow marker between them" width="705" height="340" data-path="images/decision-table-node.png" />

## How to read a decision table

| Part               | Meaning                                                                   |
| :----------------- | :------------------------------------------------------------------------ |
| **Input columns**  | The values a rule looks at (left of the arrow marker)                     |
| **Output columns** | The values a matching rule produces (right of the arrow marker `→`)       |
| **Rows**           | One rule each, checked from top to bottom                                 |
| **`any`**          | A wildcard cell — this rule does not care about that input's value        |
| **First-match**    | The **first** row whose inputs all match wins; no later row is considered |

The **first-match** badge on the table is a reminder that order matters: rules are evaluated top to bottom, and evaluation stops at the first row that matches. A row full of `any` at the bottom is a common way to provide a catch-all default.

An input cell matches when the input **equals** the cell's value (an enum option or a boolean), or when the cell is **`any`**. Output cells are expressions, so an outcome can be a fixed value or a small calculation.

## Creating a decision table

The quickest way to add a decision table is to ask the **[Lab Agent](/fundamentals/change-your-blueprint/lab-agent)**. Describe the rule as a mapping — for example *"map each score band and binding flag to a legal consequence"* — and the agent builds the table for you. When a rule is a straightforward lookup, the agent now prefers a decision table over a chain of decisions.

Decision tables are also part of the underlying Blueprint logic, so they are created and regenerated whenever your logic is generated or edited with AI.

## Editing cells

To change a decision table by hand, **maximize** it first: click its maximize icon to open the full-width view, which shows the table's name, its first-match policy, and the complete grid.

<img src="https://mintcdn.com/leapter/s6LpHBfJjFeOR_rO/images/decision-table-maximized.png?fit=max&auto=format&n=s6LpHBfJjFeOR_rO&q=85&s=7912aeca788d281f4866eb4d2974a767" alt="A maximized decision table showing the name, the first-match policy, and the full grid of rules" width="660" height="418" data-path="images/decision-table-maximized.png" />

On the maximized table you can:

* **Edit a value cell** — click a cell and type a new value.
* **Toggle a wildcard** — switch a cell to or from **`any`**.

Edits go through the same save path as any other change, so they appear in the [Timeline](/fundamentals/track-changes/timeline), can be undone, and show up in review just like edits to any other element.

<Note>
  Editing the compact grid in the flow, and adding or removing whole columns, are not available yet — maximize the table to edit its cells, and use the Lab Agent to change its shape.
</Note>

## Running a decision table

When you [run your Blueprint](/fundamentals/test-your-blueprint), the row that fired lights up in the table, so you can see exactly which rule applied for a given set of inputs. This makes it easy to confirm that the right rule won — especially useful when several rows could plausibly match and first-match order decides between them.

## What to do next

* **[Controlling the Flow](/fundamentals/leapter-canvas/controlling-the-flow)** — the other elements that make up a Blueprint
* **[Lab Agent](/fundamentals/change-your-blueprint/lab-agent)** — build and edit decision tables by describing the rules
* **[Test your Blueprint](/fundamentals/test-your-blueprint)** — run your logic and see which row fires
