# Variables

Variables represent values used during rule execution. They provide a way to reference and reuse data inside rules instead of working with hardcoded values directly.

A variable can contain data provided to the rule, values created during execution, or results produced by the rule itself. Once available, the value can be reused in other conditions, calculations, expressions, or execution steps.

The available variable types and variable addressing syntax depend on the selected rule type.

***

## Variables by Rule Type

In this section you can find list of variables available for each rule type.

### Decision Tables

Decision Tables support:

* [Input Model Variables](/doc/rules/common-rule-features/input-and-output.md)
* [Output Model Variables](/doc/rules/common-rule-features/input-and-output.md)
* [Rule Variables](/doc/rules/common-rule-features/variables/rule-variables.md)
* Column Variables

#### Column Variables

Columns inside a Decision Table can reference values from previously evaluated columns.

This applies to:

* Condition columns
* Calculation columns
* Result columns

In each Decison Table row scenario columns are evaluated from left to right, therefore a column can only reference columns that were already evaluated earlier in the table.

*If a variable reference is used before the referenced value is created or evaluated, the variable will **not** be recognized.*

Example of variables being used correctly in Decision Table:

* Columns are referensed after their declaration/evaluation.

<figure><img src="/files/Gqpje83gGzuWZge2YgAU" alt=""><figcaption></figcaption></figure>

Incorrect use of column references in Decision Tables:

* Column is referensed before its evaluation therefore its not recognized.

<figure><img src="/files/X3KUfWTbHDwSFGlQQYkm" alt=""><figcaption></figcaption></figure>

```json
{basicPrice}  //variable from input model
{discount}    //created calculation column variable
```

***

### Decision Trees

Decision Trees support:

* [Input Model Variables](/doc/rules/common-rule-features/input-and-output.md)
* [Output Model Variables](/doc/rules/common-rule-features/input-and-output.md)
* [Rule Variables](/doc/rules/common-rule-features/variables/rule-variables.md)

```json
{package.weight}  //variable from input model
{rate}            //created rule variable
```

Variables are commonly used in node conditions and result branches.

<figure><img src="/files/oRDIGwkLBvmkZEoZRhPb" alt=""><figcaption></figcaption></figure>

Example how to use variables in Decision tree:

<figure><img src="/files/L7BjOQG5MNWGNzaVUyWZ" alt=""><figcaption></figcaption></figure>

***

### Scripting Rules

Scripting Rules support:

* [Input Model Variables](/doc/rules/common-rule-features/input-and-output.md)
* [Output Model Variables](/doc/rules/common-rule-features/input-and-output.md)
* [Rule variables](/doc/rules/common-rule-features/variables/rule-variables.md)

Variables are referenced using dot notation.

Example of variables used in Scripting Rule:

```json
input.customer.country   //variable from IO model
ruleVariables.rate       //created rule variable
output.result            //variable from IO model
```

<figure><img src="/files/S7rYga3ayNC3ZYOs2k7v" alt=""><figcaption></figcaption></figure>

***

### Decision Flows and Integration Flows

Decision Flows and Integration Flows support:

* [Input Model Variables](/doc/rules/common-rule-features/input-and-output.md)
* [Output Model Variables](/doc/rules/common-rule-features/input-and-output.md)
* Variables created in flow and during flow execution

Variables can be reused between nodes and flow steps.

Both curly bracket syntax and dot notation are supported here.

```json
{input.age}             //variable from IO model
{rule.output.pricing}   //variable referencing output of evaluated business rule
{globalVariable.rate}   //created global variable
{newVariable}           //new variable created in flow
{output.result}         //variable from IO model
```

<figure><img src="/files/uBYgiEPw61W0VlEFSoIo" alt=""><figcaption></figcaption></figure>

***

### AI Agents

AI Agents support:

* [Input Model Variables](/doc/rules/common-rule-features/input-and-output.md)
* [Output Model Variables](/doc/rules/common-rule-features/input-and-output.md)
* Attachments
* [Rule Variables](/doc/rules/common-rule-features/variables/rule-variables.md)

Attachments and generated values can be reused during execution.

```json
{customer.age}             //variable from input model
{attachement.policies.pdf} //variable referencing attachement added to the ai rule
```

<figure><img src="/files/f4yhROYyRQ4b25iwMUbi" alt=""><figcaption></figcaption></figure>

***

### Lookup Tables

[Lookup Tables](/doc/rules/lookup-table.md) **do not** support:

* Model Variables
* Rule Variables

They operate only with values defined directly inside the table.

***

## Rule Variables

Rule Variables are variables created within the context of a specific rule.

They are typically used for:

* Temporary values
* Intermediate calculations
* Shared reusable values inside the rule

Rule Variables exist only during the current rule execution.

Detailed information about Rule Variables is available on the [dedicated Rule Variables documentation page](/doc/rules/common-rule-features/variables/rule-variables.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.decisionrules.io/doc/rules/common-rule-features/variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
