Creating variables to use with objects
A workbook variable holds one value for the workbook. Changing the variable changes every place that reads it, so you do not have to edit each object. You can:
- Read and set variables in actions, for example with the Set [variable] to [value] block.
- Show or hide an object according to a Boolean variable, from its show/hide button in Layers. See Using Layers to design and manage items.
- Bind a measure’s parameters to variables. See Measure parameters.
- Set a variable from an embed link. See Pass filters and variables in the address.
These are variables of a workbook. A Data App has no workbook variables: it sends parameter values with its queries instead, as Querying the engine describes.
Types of variables
Section titled “Types of variables”| Type | Value |
|---|---|
| Boolean | True or False. Use it in conditions, or to show and hide objects. |
| Number | A number, or a date when you choose Date instead of Number. Use it in calculations and comparisons. |
| String | Text. Its sub-type is Plain text by default, or SQL query. |
A String variable with the SQL query sub-type holds a SQL statement. The Execute SQL blocks in the Writeback & SQL category of actions list only these variables, and run the statement stored in the one you choose.
Creating variables
Section titled “Creating variables”-
In the toolbar on the left of the Workbook Editor, select Variables.
-
Select Add Variable. A new variable is added to the bottom of the list with a generated name.
-
Enter a name in the Name new variable field. Each name must be unique in the workbook.
-
Choose the type, then set the value:
- Boolean: select True or False.
- Number: choose Number and enter a number in Value, or choose Date and pick a date.
- String: enter the text in Value, or select More to open Define your variable. There, choose Plain text or SQL query, enter the value in the larger field and select Done.
-
Optionally, select Exclude from bookmarks, so that bookmarks neither save nor restore this variable’s value.
The menu on each variable has Copy Variable and Delete. Above the list, Copy all variables copies the workbook’s variables to the clipboard, and Paste variables adds variables from the clipboard.
Example
Section titled “Example”A variable can hold a benchmark that a chart compares its data against. In the recording above, the variable holds a fuel-efficiency target, and the chart changes as soon as the target is updated. For the difference between workbook variables and the parameters they feed, see Measure parameters.

