Additional updates to variables

pull/112/head
Nora 2019-03-28 13:00:23 -07:00
parent d42ecc71c4
commit a31e8cd710
1 changed files with 36 additions and 28 deletions

View File

@ -1,5 +1,5 @@
---
title: Variables
title: Manage variables
description:
menu:
v2_0:
@ -9,26 +9,39 @@ weight: 1
#enterprise_some: true
#cloud_all: true
#cloud_some: true
"v2.0/tags": [influxdb]
"v2.0/tags": [variables]
---
Dashboard variables allow you to alter specific components of cells' queries
without having to edit the queries, making it easy to interact with your dashboard cells and explore your data.
Variables can be nested.
## Manage variables
Variables are used in cell queries and titles when creating dashboards.
Within the query, variables are referenced by surrounding the variable name with colons (`:`).
** insert example here**
Variables are scoped by organization.
### Create a variable
1. Click in the **Organizations** icon in the navigation bar.
## Create a variable in the InfluxDB UI
* will only take the first table in the output stream
* will only use values out of the `_value` column
* generally means youd want to group everything into a single table (use group function, default is group_by ALL)
* if the data youre looking for is in a column other than `_value`, than you want to rename that column to `_value`
* flux doesnt let you have unbound queries so you have to have a timeframe on a query (range function). want to keep your range fairly limited.
* you cant use the predefined dashboard variables: time range start, stop, window. you cant use those because they dont exist in the context in which the query runs. only exist within the context of a dashboard.
### Create a variable in the Data Explorer
1. Click the **Data Explorer** icon in the sidebar.
{{< nav-icon "data-explorer" >}}
2. Click **Script Editor** on the lower right.
3. Build the query for your variable using the [Table visualization type](v2.0/visualize-data/visualization-types/#table) or enable the **View Raw Data** option.
4. Click **Save As** in the upper right.
5. In the window that appears, select **Variable**.
6. Enter a name for your variable in the **Name** field.
7. Click **Create**.
### Create a variable in the Organizations page
1. Click the **Organizations** icon in the navigation bar.
{{< nav-icon "orgs" >}}
@ -38,25 +51,20 @@ Variables are scoped by organization.
5. Enter your variable.
6. Click **Create**.
### Other way to create a variable
1. From data explorer > script editor
2. save as variable
3. shows up in variables list
### Import a variable
1. Click in the **Organizations** icon in the navigation bar.
## Import a variable
1. Click the **Organizations** icon in the navigation bar.
{{< nav-icon "orgs" >}}
2. Select the **Variables** tab.
3. Click the **+Create Variable** dropdown menu and select **Import Variable**.
4. ?? Nothing happens
2. Select an organization from the list.
3. Select the **Variables** tab.
4.
4. Click the **+Create Variable** dropdown menu and select **Import Variable**.
5. Select
### Export a variable
1. Click in the **Organizations** icon in the navigation bar.
1. Click the **Organizations** icon in the navigation bar.
{{< nav-icon "orgs" >}}
@ -66,7 +74,7 @@ Variables are scoped by organization.
### Update a variable's name
1. Click in the **Organizations** icon in the navigation bar.
1. Click the **Organizations** icon in the navigation bar.
{{< nav-icon "orgs" >}}