> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowforma.com/llms.txt
> Use this file to discover all available pages before exploring further.

# User Variables

> Store data against a FlowForma Analytics user to set default branches, swap data connections and tables, and tailor SQL clauses, filters, and chart titles.

User variables are a way of storing data against a particular user. A good example for how to use a User Variable would be when you have multiple branches, and you want data for a particular branch to load by default when a user logs in. Although the user would also be able to access data from other branches if they needed to, the data for the branch they work at would be loaded as soon as they log in.

You can use this functionality for:

* Data connection details. Different users can connect to different databases without having to set up multiple Data Connections.
* Swap tables viewed within a connection. Different users can view database level restricted tables or views.
* Swap SELECT, WHERE or ORDER BY clauses.
* Pass date time format masks.
* Apply filters in charts.
* Change chart titles.

Variables are incorporated into the "Users" interface. To create a new variable, select the user on the left-hand side of the screen and click the **Variables** link.

<img src="https://mintcdn.com/flowforma/Zn2WkWfptDcXdttX/images/product/flowforma-analytics/manage-users/user-permissions-privileges/user-variables/user-variables-1.png?fit=max&auto=format&n=Zn2WkWfptDcXdttX&q=85&s=6f84bf46f6f7d32be973c5c59b0610ab" alt="Users interface Variables link" width="760" height="120" data-path="images/product/flowforma-analytics/manage-users/user-permissions-privileges/user-variables/user-variables-1.png" />

To create a new variable, click the 'Add' icon on the right-hand side of the screen.

<img src="https://mintcdn.com/flowforma/Zn2WkWfptDcXdttX/images/product/flowforma-analytics/manage-users/user-permissions-privileges/user-variables/user-variables-2.png?fit=max&auto=format&n=Zn2WkWfptDcXdttX&q=85&s=fb658c4f3130885e1eb66522242a07a9" alt="Add variable icon" width="760" height="59" data-path="images/product/flowforma-analytics/manage-users/user-permissions-privileges/user-variables/user-variables-2.png" />

Specify the user variable by typing the name of the variable into the first column and the variable value into the second column.

**Example**

In the following screenshot, a variable has been added that will default the view to the Gateshead branch when the selected user logs in.

<img src="https://mintcdn.com/flowforma/Zn2WkWfptDcXdttX/images/product/flowforma-analytics/manage-users/user-permissions-privileges/user-variables/user-variables-3.png?fit=max&auto=format&n=Zn2WkWfptDcXdttX&q=85&s=a2e3a3326e31860514bdcd718acd518d" alt="Variable set to Gateshead branch" width="1155" height="142" data-path="images/product/flowforma-analytics/manage-users/user-permissions-privileges/user-variables/user-variables-3.png" />

For all other users, the default branch will be Liverpool, which has been specified in the Settings menu of the Dashboard Configuration screen.

<img src="https://mintcdn.com/flowforma/Zn2WkWfptDcXdttX/images/product/flowforma-analytics/manage-users/user-permissions-privileges/user-variables/user-variables-4.png?fit=max&auto=format&n=Zn2WkWfptDcXdttX&q=85&s=a3d4b062ed6bc2b7547e38b73979a1c2" alt="Default branch setting of Liverpool" width="1050" height="169" data-path="images/product/flowforma-analytics/manage-users/user-permissions-privileges/user-variables/user-variables-4.png" />

To add more variables for a user, click the 'Add' icon again and repeat the steps listed above.

User variables work in conjunction with system variables.

If you have a **system** variable 'USER\_NAME' set to 'FRED' then:

* If a user has a **user variable** 'USER\_NAME' of 'JOE', then for that user it will return 'JOE'.
* If a different user doesn't have a **user variable**, then it will use the **system** variable 'FRED' instead.

On the other hand, if you don't have a **system** variable for 'USER\_NAME' set, then:

* If a user has a **user variable** 'USER\_NAME' of 'JOE', then for that user it will return 'JOE'.
* If a different user doesn't have a **user variable**, there will be no **system** variable to fall back on, which could cause problems.

If you created a variable to store data connection username prior to version 2020-11-26 and you then upgrade to version 2020-11-26 or beyond you will need to tick the **Keep Secure** box next to it for the data connection to work.

If a variable is added to the 'User Variable' section that matches a System or Environment Variable a warning message like the one shown below will be displayed. In the following example, a System Variable already exists, which has been made secure, when the same variable is added to the User Variable screen it will be automatically set to the same security level as the System Variable and this cannot be modified.

<img src="https://mintcdn.com/flowforma/Zn2WkWfptDcXdttX/images/product/flowforma-analytics/manage-users/user-permissions-privileges/user-variables/user-variables-5.png?fit=max&auto=format&n=Zn2WkWfptDcXdttX&q=85&s=2bd3c75f5c9d81cc1616764cc3caf09b" alt="Warning that variable matches a secure System Variable" width="1070" height="159" data-path="images/product/flowforma-analytics/manage-users/user-permissions-privileges/user-variables/user-variables-5.png" />

In addition to this, if you add the same variable name twice the following message will be displayed.

<img src="https://mintcdn.com/flowforma/Zn2WkWfptDcXdttX/images/product/flowforma-analytics/manage-users/user-permissions-privileges/user-variables/user-variables-6.png?fit=max&auto=format&n=Zn2WkWfptDcXdttX&q=85&s=5b747fc08de0c3cef7c5efdf52902440" alt="Warning for duplicate variable name" width="1223" height="194" data-path="images/product/flowforma-analytics/manage-users/user-permissions-privileges/user-variables/user-variables-6.png" />

When variables have been specified for a user, a number indicating how many variables there are is displayed next to the **Variables** menu at the top of the screen.

<img src="https://mintcdn.com/flowforma/Zn2WkWfptDcXdttX/images/product/flowforma-analytics/manage-users/user-permissions-privileges/user-variables/user-variables-7.png?fit=max&auto=format&n=Zn2WkWfptDcXdttX&q=85&s=82491e2489f9883c8e8a23f3a879d031" alt="Variables count shown next to the menu" width="731" height="114" data-path="images/product/flowforma-analytics/manage-users/user-permissions-privileges/user-variables/user-variables-7.png" />

## Deleting user variables

To delete a user variable, select the user on the left-hand side of the screen and then click the **Variables** link.

Click the 'Remove' icon next to the variable that you want to delete.

<img src="https://mintcdn.com/flowforma/Zn2WkWfptDcXdttX/images/product/flowforma-analytics/manage-users/user-permissions-privileges/user-variables/user-variables-8.png?fit=max&auto=format&n=Zn2WkWfptDcXdttX&q=85&s=bc3b8ba95d0d8bfef44c1106cd1ae53a" alt="Remove icon next to a variable" width="731" height="83" data-path="images/product/flowforma-analytics/manage-users/user-permissions-privileges/user-variables/user-variables-8.png" />
