๐งโ๐ณUse variables in YouPrepโข
Last updated
Last updated
When preparing data with YouPrep, you can use variables when configuring certain steps. Variables are objects that allow to make a reference to a contextual environment (user context, date context, value taken by an app filter, etc.).
We will distinguish 2 types of variables:
Internal variables: those are variables referring and/or managed within Toucan
External variables (also known as extra params): these are variables coming from an external environnement (in embedded cases)
Within YouPrep, when configuring a step, you can easily refer to variable by clicking on the "{}" widget. This will grant you access to the list of internal variables and the ability to create advanced variables (applicable to both external variables and internal variables).
You can know more about variables by referring to this page.
Internal variables refer to elements managed within Toucan.
There are several types of internal variables:
App variables
User attributes: refer to contextual elements depending on the user
Dates (managed automatically by Toucan)
App filters: value taken by an app filter
Important
When referring to a dynamic variable (changing depending on the user context), you will only be able to define the resulting dataset as a Live one, since the computation is depending on the user context, and thus on the end-user context.
External variables refer to elements coming from an external environment, which is very useful in an embedded context.
Within the variable menu, you can refer to external variable by choosing the "Advanced variable" option. This allows you to refer to an external variable that will be sent by your software in which you will embed Toucan's charts.
To make a reference to an external variable, use the following syntax (in the example below we refer to a variable named country):
Since the external variable is not accessible while evolving in Toucan, you can apply a condition to setup a default value when there is no value.
Warning
Defining a default value can eventually present security risks (on production) depending on the nature of variable you are using. This is especially true if the software in which you embed Toucan's chart does not always retrieve a value for the variable you are using.
Warning
Advanced variables (aka custom variables) in YouPrep correspond to front-end variables, meaning that the value taken by the variable is set, and sent by the user's browser. To avoid any security risk, make sure not to refer to variables that will manage data access in production mode.