Using Variables
Types of Variables
There are three types of variables in dashplot:
- Global Variables: These are provided by default and cannot be edited neither can new ones be created.
- Dashplot Variables: These are variables that are used in more than one visualization in a dashboard. They appear at the top of the dashboard and changing their value affects all the visualization that are using it. They cannot be created explicitly. If a same name and type of variable is used in more than one visualization in a dashboard they are automatically promoted to dashplot variable.
- Local Variables: Local variables are used only in a single visualization.
Existing Variables
You can use variables in a query statement to store values. To select a default variable, do the following:
- Place the cursor at any position in the query script editor and add open and close single quotations.
- Click the Variable button. A drop-down list of existing variables is displayed.
- Click the variable name from the list. The variable is added within the open and close single quotations.
The variable can also be typed within the single quotes by simply using the following format i.e. '${variable name}'.
- Click the Execute Query button to run the query.
List of default variables
Variable name | Description |
---|---|
from_date_epoc | Is a variable that allows you to select a date and time from which an event had begun. The final value is transferred to server in epoc milliseconds. __ |
from_date_sec | Is a variable that allows you to select a date and time from which an event had begun. The final value is transferred to server in epoc seconds. |
to_date_epoc | Is a variable that allows you to select the last date and time until which the event occurred. The final value is transferred to server in second epoc millisecond. __ |
to_date_sec | Is a variable that allows you to select the last date and time until which the event occurred. The final value is transferred to server in epoc seconds. |
Creating a New Variable
To create a new variable, perform the following:
- Start by entering a variable name in the SQL query in the following format: '${variable name}'. The variable is displayed below the SQL script editor.
- Click the settings icon to edit the variable. A pop-up dialog box is displayed.
- Provide a variable name.
- Select one of the following data types.
Data type | Description |
---|---|
Text | Text type variable stores any kind of data in the form of text. |
Number | Number type variable stores data in the form of integers only. |
Date | Date type variable stores data in a date format. |
Dropdown | Dropdown type variable allows you to provide values to choose from or make a multiple selection with the help of separators like comma, vertical line, space and tilde. |
Query | Query type variable allows you to write a query. Once the query is run successfully, the query output is displayed in the Values box. You can allow multiple selection with the help of separators like comma, vertical line, space and tilde. |
- Click Apply to save your changes.

- Select or enter a value based on the variable or data type selected from the drop-down menu below the variable name.

- Click the Execute Query button to run the query. The query accordingly returns a table with sample data and a visualization.