# Custom Variable

### The Goal

Add and set up *Custom Variable* and check its setting in the *Data Explorer*.

![Custom Variable](/files/uhZBuwhXhoip8lGZOeP4)

### The Description

The *State Variable* is part of a current *View* where its setting is immediately reflected in the *Data Explorer* and its plays important role in storing temporary data within a current *View*.

{% hint style="info" %}
Keep in mind that *State Variables* are not addressable between another *Views*.
{% endhint %}

### The Knowledge You Will Get

1. *Addressing* and *Editing* of a *State Variable*.

### The Project Structure

{% tabs %}
{% tab title="View\[MainView]" %}

* [ ] State Variable\[`myVariable`]
  {% endtab %}
  {% endtabs %}

### 1. Create a State Variable

1. Clicking on the *Add Datasource icon* select **Add State Variable**.
2. Name its *ID* -> `myVariable` and switch its *Type* to *Number*; *Initial Value* -> `6`

{% hint style="info" %}
You can watch the `myVariable` *attributes* and *functions* in the *tab* from this moment.
{% endhint %}

{% tabs %}
{% tab title="Outline\[myVariable]" %}
![](/files/lrB9lCYn478nAyMyCLdT)
{% endtab %}

{% tab title="Data Explorer\[myVariable]" %}
![](/files/bqK6JnqVNtBxKYk7NuTT)
{% endtab %}
{% endtabs %}

### 2. Associating `myVariable` Value

1. Consider that we are not going to play with *Layout*; simply place in the *Canvas work field* a new **Text** component and set up its *Value* as follows:
2. *Value* -> `myVariable.value`

{% hint style="info" %}
The Current Value of the myVariable can be dynamically mapped by a (ƒx) *function*.
{% endhint %}

{% tabs %}
{% tab title="Canvas\[MainView]" %}
![](/files/ZdhFtE3pj9MOHR0NtyRU)
{% endtab %}

{% tab title="text1\[Value fx]" %}
![](/files/hAWyM1psMPb6e5BTzCKE)
{% endtab %}
{% endtabs %}

### The Conclusion

Using the *State Variable* can be effectively used in many cases. Try to change *State Variable Types* to *Array* or *Map*, and define their *Values* as a constant or function.

{% hint style="info" %}
Follow up on our *Custom Variable* tutorial <https://youtu.be/ul_NTuZODWc>
{% endhint %}


---

# 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.adapptio.com/working-with-adapptio/how-to/data-and-dynamic-values/custom-variable.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.
