Variables are an important feature and allow the dashboard developer to create a richer end-user dashboard experience. One way variables can be used is to conditionalize the user interface — hiding and showing different user interface elements or dynamically changing user filters. Another way is in expressions, to make them more dynamic.
Bind an object's visibility to a variable, then change that variable from anywhere — like a button click — to build a dynamic, app-like interface.
OverviewChart is equal to 2.
OverviewChart to 2 when clicked.There are two ways of referencing a variable: by name and using macro notation. To reference a variable by name, simply type its name and the variable value will be replaced. Macro notation uses the syntax $(variablename) — it replaces the variable with its value before the expression is parsed, allowing you to use variables to contain expression fragments.
| Expression | Description |
|---|---|
Count(Orders.ID, WHERE(Sales.OrderDateYear, CurrentYear)) |
The variable CurrentYear is replaced with its value after the expression is parsed and is executing. |
Count(Orders.ID, $(FilterExpression)) |
The variable FilterExpression is replaced with its value before the expression is parsed and executed.FilterExpression = "WHERE(Sales.OrderDateYear, 2010)" |
if(GetColumn(1) = CurrentYear,
Count(Orders.ID),
Count(Orders.ID) * 1000) |
The variable CurrentYear is replaced with its value. If the chart dimension of the first column is equal to the value of the variable CurrentYear, then count orders — else count orders × 1000. |
Book a demo and we'll build a dynamic, variable-driven dashboard with your own data.
Request a demo