# Variables

Decision Tree **Variables** allow you to record the branches selected by your users to improve, speed up, and simplify their journey.

{% hint style="info" %}
**For example**: in the case of a discovery tree focused on discovering customer needs, you can record the age of the contact to subsequently "eliminate" branches that do not deal with their category.
{% endhint %}

The purpose of variables is therefore multiple:

* Guide your users in creating decision trees;
* Avoid suggesting irrelevant branching options, which could cause errors;
* Speed ​​up the creation of decision trees;
* Refine the results of decision trees.

## Create a variable

In the "Decision Tree" section of your organisation, click the button <img src="https://160715368-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFCbypPSQCx2ezWjFUPY%2Fuploads%2FkLDud5ixxM1dfZBKRKkD%2Fimage.png?alt=media&#x26;token=2a0b9b95-d101-42ef-9fdb-ca912eb3cc63" alt="" data-size="line"> at the bottom of the page.

<figure><img src="https://160715368-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFCbypPSQCx2ezWjFUPY%2Fuploads%2F4duaDuTNSbav7LluiHaF%2Fimage.png?alt=media&#x26;token=5b9c719a-93d6-4f8f-b742-987aba16d734" alt="" width="563"><figcaption></figcaption></figure>

For each variable created, you must enter:

* **Its name**: This will be used later to identify the variable.
* **Its values**: These correspond to all possible "answers" for this variable.

{% hint style="info" %}
For example, regarding the age of the person you are talking to:

* **Their name**: "Age".
* **Its values**: "Under 33", "Between 33 and 66", "Over 66".
  {% endhint %}

<figure><img src="https://160715368-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFCbypPSQCx2ezWjFUPY%2Fuploads%2FxXjTYh3SCvG2mT9vTWu2%2Fimage.png?alt=media&#x26;token=0f255c87-9d3f-47cf-aae0-b54ab0b75c6a" alt="" width="449"><figcaption></figcaption></figure>

{% hint style="danger" %}
For a value to be taken into account, you must press the "**Enter**" key on your keyboard so that the selection looks like the first 2 values ​​in the screenshot above.
{% endhint %}

## Use a variable

To continue our example, let's say a company sells three products for three distinct demographics:

* Video games for customers under 33;
* Strollers for customers between 33 and 66;
* Anti-wrinkle cream for customers over 66.

In the decision tree for discovering this company's specific customer needs, management wants the anti-wrinkle cream not to be displayed to users when their contacts have indicated they are under 33, in particular to minimise potential selection errors.

This decision tree therefore includes at least one "Interlocutor's Age" node, where users will categorize their contacts according to the three age groups, and a "Products Used" node, where users will ask their contacts if they have ever used the company's products.

You must therefore:

1. Mark the "Interlocutor's Age" node as responsible for the "Age" variable so that the response is recorded;
2. Filter the destinations of the "Products Used" node if the interlocutor is under 33 years old to hide the "Anti-Wrinkle" destination.

### 1. Mark a node as responsible for a variable

* Click on the node whose destinations are **exactly** the same as the values ​​you previously defined for your variable.
* Click on the following icon to mark the node as responsible for a variable. <img src="https://160715368-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFCbypPSQCx2ezWjFUPY%2Fuploads%2FkYHh0NPe8lachvjlKX1k%2Fimage.png?alt=media&#x26;token=7b8d2fe9-59aa-467d-9bc7-29800272d57b" alt="" data-size="line">
* Select your variable from the drop-down list.
  * If the destinations of this node are exactly the same as the values ​​of the selected variable, the following window will appear.\\

    <figure><img src="https://160715368-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFCbypPSQCx2ezWjFUPY%2Fuploads%2FV64aqkfUUsdH43xiekr4%2Fimage.png?alt=media&#x26;token=c4aaeb60-dafa-4ffa-90cf-9910bad10ac6" alt="" width="451"><figcaption></figcaption></figure>
  * Otherwise, the values ​​of your variable that were not found at the destination node will be indicated in red: <img src="https://160715368-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFCbypPSQCx2ezWjFUPY%2Fuploads%2F6bFycGsFh5xG3HBOhbna%2Fimage.png?alt=media&#x26;token=0e863aae-dfae-4d49-b579-4723e20f7f71" alt="" data-size="line">
* Save your selection, and you're done! The "Interlocutor's Age" node now saves the destination that will be selected by your users.

### 2. Filter destinations based on the saved variable

* Click on the node containing the destination you want to hide.
* Click on the following icon, which allows you to filter/hide a destination based on certain rules.

<figure><img src="https://160715368-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFCbypPSQCx2ezWjFUPY%2Fuploads%2Fs3plzpy4sziXykJttXmM%2Fimage.png?alt=media&#x26;token=413b9ca9-ea09-4568-b044-9996929d2c04" alt="" width="242"><figcaption></figcaption></figure>

* Click the "**Add Filter**" button.
* Select your variable from the drop-down list and click the "**Save**" button.
* Click on the row corresponding to your variable to display the filter rules.
  * Prohibited values: The filtered destination is not a possible destination if the "Age" variable has recorded one of the values ​​entered (see screenshot below).
  * Allowed values: The filtered destination is only a possible destination if the "Age" variable has recorded one of the values ​​entered.

<figure><img src="https://160715368-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFCbypPSQCx2ezWjFUPY%2Fuploads%2FYZ7lRvhJaf5joVR5QgRR%2Fimage.png?alt=media&#x26;token=e2b84b17-3a61-489a-a51e-f27b9d2e7984" alt="" width="449"><figcaption></figcaption></figure>

* It's done! The "Products Used" node destinations for people under 33 no longer show the "Anti-Wrinkle" destination.

<figure><img src="https://160715368-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRFCbypPSQCx2ezWjFUPY%2Fuploads%2Fo9yypUIH5FzhagLoDu0Y%2Fimage.png?alt=media&#x26;token=4764cf06-959b-499a-a442-64a4868a2f93" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="info" %}
You can add as many conditions as you like per variable. If you add multiple conditions, all must be met for the destination to be available.

* **For example**: "Age" is "Under 33" AND "Purchasing Power" is not "High" to hide overpriced video games.
  {% endhint %}
