# Variables

You can create variables within a form and with the help of functions feature set up complex calculations, conditions, conditional styling and etc. &#x20;

Below is example of setting up variable and using it for conditional hiding a section.

{% hint style="success" %}
&#x20;Form in the example below is tied up to Account object
{% endhint %}

Open "Tools" menu(1) and click "Variables" option (2):

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2FAUYmVeEiudBb6nSNhzFr%2Ffile.excalidraw.svg?alt=media&#x26;token=aba8caf9-1119-4df2-b6fb-3af5f725d6ce" alt="" class="gitbook-drawing">

On "Variables" popup click "Add Variables" button (3):

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2FGCrPHPLBYUbNg6Gmphl1%2Ffile.excalidraw.svg?alt=media&#x26;token=9fa1624d-c647-4ae7-8cf0-29d4df78be5e" alt="" class="gitbook-drawing">

Provide variable "Name" (4), set variable "Type" (5) and click pencil icon (6) to open value builder:

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2FOZJJT7lpFJmObl4s1C78%2Ffile.excalidraw.svg?alt=media&#x26;token=c3d8fae1-d4ed-422d-a991-c860186ff8bd" alt="" class="gitbook-drawing">

Choose context object (7) and  object field (8). Click "+" button to insert merged field (9):

{% hint style="success" %}
For more information about working with context objects please refer following documentation chapter:

[Context Objects](https://x-screensteps-link/screensteps.com)
{% endhint %}

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2Faa394xE43vHTlEn06ndk%2Ffile.excalidraw.svg?alt=media&#x26;token=886619c3-b1c7-410d-8e16-dc7f7774a347" alt="" class="gitbook-drawing">

Select Function (10) to use  and click "+" button (10) to insert function:

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2FFGpHlat04T0ZlcCSwWg1%2Ffile.excalidraw.svg?alt=media&#x26;token=84a54ee5-b718-4f6f-9694-126287d430d5" alt="" class="gitbook-drawing">

Now using merged field and functions build an expression (12) and click "Save" (13).

{% hint style="success" %}
To use the functions or calculations inside of variable you have to build a formula like: FORMULA\[SQRT(4) + (2\*3)]
{% endhint %}

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2FuLNl63tamsc0jixp5e4a%2Ffile.excalidraw.svg?alt=media&#x26;token=bc4fef16-a9e2-4323-b035-6388cc0afb75" alt="" class="gitbook-drawing">

{% hint style="success" %}
Above expression first casts number typed value to text and then checks if final string ends with '9'. It will return 'true' if string does end with '9' and 'false' if it doesn't.
{% endhint %}

Save variable (14) and save the form (15):

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2FKM09OKrKH5OMbp9sbvhi%2Ffile.excalidraw.svg?alt=media&#x26;token=267b3209-6bdb-4af5-91a4-5fdee2abdd7c" alt="" class="gitbook-drawing">

{% hint style="success" %}
Button "Dependencies" (16) helps to find where this variable is used.
{% endhint %}

Select [Section](https://x-screensteps-link/screensteps.com) title and create new [Conditional style](https://x-screensteps-link/screensteps.com) using configured variable:

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2FzksyyoVLlgmF73veGkEg%2Ffile.excalidraw.svg?alt=media&#x26;token=ad9abb19-bff1-4774-b740-b5a7489a6e07" alt="" class="gitbook-drawing">

{% hint style="success" %}
Above conditional style will hide section if 'Account Number' value ends with symbol other than '9' and will show it for cases when it ends with '9'.
{% endhint %}
