2.7 KiB
title | seotitle | description | menu | weight | v2.0/tags | |||||
---|---|---|---|---|---|---|---|---|---|---|
Create a variable | Create a dashboard variable | Create dashboard variables in the Data Explorer, from the Organization page, or import a variable. |
|
201 |
|
Create dashboard variables in the Data Explorer, from the Settings section, or import a variable. Variable names must be unique.
There are multiple variable types that provide different means of populating your list of variable values. For information about variable types, see Variable types.
{{% note %}}
Reserved keywords
The following names cannot be used as dashboard variables because they are reserved keywords in Flux:
and
, import
, not
, return
, option
, test
, empty
, in
, or
, package
, and builtin
.
{{% /note %}}
Create a variable in the Data Explorer
{{% note %}} InfluxData recommends using the Data Explorer to create Query dashboard variables. The Table visualization type and View Raw Data option to provide human-readable query results. {{% /note %}}
-
Click the Data Explorer icon in the sidebar.
{{< nav-icon "data-explorer" >}}
-
Use the Query Builder or Script Editor to build a query.
-
Use the Table visualization type or enable the View Raw Data option to view human-readable query results.
-
Click Save As in the upper right.
-
In the window that appears, select Variable.
-
Enter a name for your variable in the Name field.
-
Click Create.
For information about common Query variables, see Common variable queries.
Create a variable in the Settings section
-
Click the Settings icon in the navigation bar.
{{< nav-icon "settings" >}}
-
Select the Variables tab.
-
Enter a name for your variable.
-
Select your variable type. For details on each type, see Variable types.
-
Enter the appropriate variable information.
-
Click Create.
Import a variable
InfluxDB lets you import variables exported from InfluxDB in JSON format.
-
Click the Settings icon in the navigation bar.
{{< nav-icon "settings" >}}
-
Select the Variables tab.
-
Click the {{< icon "plus" >}} Create Variable drop-down menu and select Import Variable.
-
In the window that appears:
- Select Upload File to drag and drop or select a file.
- Select Paste JSON to paste in JSON.
- Click Import JSON as Variable.