Merge pull request #340 from influxdata/variable-enhancements

Enhance variable docs
pull/351/head
Scott Anderson 2019-07-23 11:27:53 -06:00 committed by GitHub
commit 543ea3c8b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 20 deletions

View File

@ -49,8 +49,9 @@ v1.measurementTagValues(
)
```
## List hosts
List all `host` tag values in a specified bucket.
## List unique tag values
List all unique tag values for a specific tag in a specified bucket.
The example below lists all unique values of the `host` tag.
_**Flux package:** [InfluxDB v1](/v2.0/reference/flux/functions/influxdb-v1/)_
_**Flux functions:** [v1.measurements()](/v2.0/reference/flux/functions/influxdb-v1/measurements/)_

View File

@ -9,53 +9,58 @@ weight: 201
"v2.0/tags": [variables]
---
Create dashboard variables in the Data Explorer, from the Organization page, or import a variable.
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](/v2.0/visualize-data/variables/variable-types/)._
### Create a variable in the Data Explorer
## Create a variable in the Data Explorer
{{% note %}}
Only [Query variables](/v2.0/visualize-data/variables/variable-types/#query)
can be created from the Data Explorer.
InfluxData recommends using the Data Explorer to create
[Query dashboard variables](/v2.0/visualize-data/variables/variable-types/#query).
The [Table visualization type](/v2.0/visualize-data/visualization-types/table/) and
**View Raw Data** option provide human-readable query results.
{{% /note %}}
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.
2. Use the **Query Builder** or **Script Editor** to build a query.
3. Use the [Table visualization type](/v2.0/visualize-data/visualization-types/table/)
or enable the **View Raw Data** option to view human-readable query results.
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 configuration page
_For information about common Query variables, see [Common variable queries](/v2.0/visualize-data/variables/common-variables/)._
## Create a variable in the Settings section
1. Click the **Settings** icon in the navigation bar.
{{< nav-icon "settings" >}}
2. Select the **Variables** tab.
3. Click **+Create Variable**.
3. Click **{{< icon "plus" >}} Create Variable**.
4. Enter a name for your variable.
5. Select your [variable type](/v2.0/visualize-data/variables/variable-types/).
6. Enter the appropriate variable information.
7. Click **Create**.
## Import a variable
InfluxDB lets you import variables exported from InfluxDB in JSON format.
1. Click the **Organizations** icon in the navigation bar.
1. Click the **Settings** icon in the navigation bar.
{{< nav-icon "orgs" >}}
{{< nav-icon "settings" >}}
2. Select an organization from the list.
3. Select the **Variables** tab.
4. Click the **+Create Variable** dropdown menu and select **Import Variable**.
3. In the window that appears:
* Select **Upload File** to drag-and-drop or select a file.
* Select **Paste JSON** to paste in JSON.
4. Select an organization from the **Destination Organization** dropdown.
5. Click **Import JSON as Variable**.
2. Select the **Variables** tab.
3. Click the **{{< icon "plus" >}} Create Variable** drop-down menu and select **Import Variable**.
4. In the window that appears:
- Select **Upload File** to drag and drop or select a file.
- Select **Paste JSON** to paste in JSON.
6. Click **Import JSON as Variable**.