# How to Work with Variables

Variables are the user defined fields that:

* can have any desirable name
* can have value of String type
* can be inserted anywhere as [Merge field](/standard-kanban/tools/using-merge-field-picker.md)
* can be updated by [Actions](/components/actions-action-groups.md)
* are initialized with initial values when Kanban page is loaded or reloaded
* are stored in memory and do not changed when Kanban is refreshed by Kanban API or "Refresh Kanban" button (and this is a perfect tool to dynamically change a lot of Kanban properties)

Variables are configured in the [proper section](/standard-kanban/configure-kanban/how-to-configure-variables.md) of Kanban Properties sidebar.

To see what values are stored in the variables, and manipulate with them, user can open a [Debug Console](/standard-kanban/using-kanban/how-to-debug-a-kanban.md) on Kanban.

Variables can be changed by different actions:

* "Update Variables" method of  [Kanban API](/components/actions-action-groups/types/kanban-api-action.md) - it allows the simple update of variable with some value.
* "Define Variable" [Global Action](/components/actions-action-groups/types/define-variable-action.md) - it allows to make calculations with variable values using formulas.<br>

Define Variable Action called from Kanban has these properties:

* it always return updated variables to Kanban where it has been called from
* it need to know the name of variable to update<br>

Example of how to CHANGE variable value via Define Variable Action:

1\. Configure action in this way:

* Type = Define Variable
* Variable Type = JSON
* Variables JSON example:

```
{"{$Variables.IncomingVariableName}":"FORMULA[IF({$Variables.IncomingVariableValue} != '1','zero','one')]"}
```

This formula updates variable value to "one" if its initial value is "1", and to "zero" if not.

{% hint style="info" %}
In the example above name of variable to update is got from Action incoming variables (that work as parameters) using merge field {$Variables.IncomingVariableName}. Initial value of variable to update is set by {$Variables.IncomingVariableValue}.\
\
Thus, an action call can pass any Kanban variable to action as pre-defined variables named "IncomingVariableName" and "IncomingVariableValue". This will allow user to re-use this action anywhere with other variables.
{% endhint %}

2\. Define some variable on Kanban, e.g. variable name = "TheVar" and value = "A":

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

3\. Configure an action (e.g., as handler on some element) and pass this variable name and value to action via action incoming variables:

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

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

Save Kanban.\
To test variables update open Kanban and check variable in Debug Console. It will show initial variable value:

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

Click on element with this action set as handler. Then open debug console again to see an updated variable:

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

This way does not allow to update variable in other Kanban, but you can first update variable in current Kanban with global action, and then [pass new value to other Kanban](/standard-kanban/howtos-and-best-practices/how-to-configure-communication-between-kanbans.md) via Kanban API "Update Variable" method.


---

# 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.flexikanban.ai/standard-kanban/using-kanban/how-to-work-with-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.
