What are Variables?

Variables are generated when you add certain components to the dashboards (dropdown selector and date selectors). In addition, the {{user_group_id}} variable is automatically created for every dashboard, and is used to segment your data between customers.

The date selector can be configured by injecting the variable {{element6}} in the SQL query in the example shown below.



All variables are contained in double curly brackets {{}}, Explo will recognize any text in-between curly brackets in your SQL query as a variable.

Double square brackets [[]] are used for where clauses with variables such that if there is no variable selected, Explo will ignore the code between the square brackets.

<aside> 💡 All variable clauses must be placed inside square brackets.


Example of where clause using a variable in square brackets:

[[WHERE field1 = {{element1}}]]

When filtering by 2 different fields, you can use the syntax below to contain the "and" in the square brackets. The 1=1 is required here otherwise there will be an incomplete clause statement if neither filter is configured.

WHERE 1=1 [[and field1 = {{element1}}]]
					[[and field2 = {{element2}}]]

Default variable for segmenting data by customers

<aside> 💡 {{user_group_id}}