diff --git a/content/v2.0/visualize-data/variables/_index.md b/content/v2.0/visualize-data/variables/_index.md index 211240158..64659aaed 100644 --- a/content/v2.0/visualize-data/variables/_index.md +++ b/content/v2.0/visualize-data/variables/_index.md @@ -28,12 +28,12 @@ from(bucket: v.bucket) |> aggregateWindow(every: v.windowPeriod, fn: mean) ``` -## Manage custom variables -As you build queries, In the Cell Editor and Data explorer, available variables are listed in the variables tab. -Must use the script builder. Click on a variable to input into your script. -Hover over the variable in the variables tab to select a value for the current query. +When building Flux queries for dashboard cells, view available dashboard variables +in the **Variables** tab next to the Functions tab. -{{< children >}} +{{< img-hd src="/img/2-0-variables-data-explorer-view.png" />}} + +Click on a variable name to add it to your query and select a value from the **Value** dropdown. ## Predefined dashboard variables The InfluxDB provides the following predefined dashboard variables: @@ -61,3 +61,8 @@ in data aggregation operations. The value of this variable is calculated by dividing the total time within the displayed time range by the dashboard refresh interval (defined by the **Refresh** dropdown). + +## Custom dashboard variables +Create, manage, and use custom dashboard variables in the InfluxDB user interface (UI). + +{{< children >}} diff --git a/content/v2.0/visualize-data/variables/common-variables.md b/content/v2.0/visualize-data/variables/common-variables.md index da17d0088..f733ed747 100644 --- a/content/v2.0/visualize-data/variables/common-variables.md +++ b/content/v2.0/visualize-data/variables/common-variables.md @@ -4,35 +4,43 @@ description: Useful queries to use to populate values in common dashboard variab menu: v2_0: parent: Use and manage variables - name: Common Variables -weight: 206 + name: Common variable queries +weight: 208 "v2.0/tags": [variables] --- -##### List buckets +### List buckets +List all buckets in the current organization. ```js buckets() - |> rename(columns: {"name": "_value"}) + |> rename(columns: {"name": "_value"}) |> keep(columns: ["_value"]) ``` -##### List measurements +### List measurements +List all measurements in a specified bucket. + ```js import "influxdata/influxdb/v1" - v1.measurements(bucket: "bucket-name") ``` -##### List hosts +### List hosts +List all `host` tag values in a specified bucket. + ```js import "influxdata/influxdb/v1" - v1.tagValues(bucket: "bucket-name", tag: "host") ``` -##### List fields in a measurement +### List fields in a measurement +List all fields in a specified bucket and measurement. + ```js import "influxdata/influxdb/v1" - -v1.measurementTagValues(bucket: "bucket-name", measurement: "measurment-name", tag: "_field") +v1.measurementTagValues( + bucket: "bucket-name", + measurement: "measurment-name", + tag: "_field" +) ``` diff --git a/content/v2.0/visualize-data/variables/create-variable.md b/content/v2.0/visualize-data/variables/create-variable.md index 44fda73c1..c7a59a6d0 100644 --- a/content/v2.0/visualize-data/variables/create-variable.md +++ b/content/v2.0/visualize-data/variables/create-variable.md @@ -11,6 +11,8 @@ weight: 201 Create dashboard variables in the Data Explorer, from the Organization page, or import a variable. +_For information about variable types, see [Variable types](/v2.0/visualize-data/variables/variable-types/)._ + ### Create a variable in the Data Explorer 1. Click the **Data Explorer** icon in the sidebar. diff --git a/content/v2.0/visualize-data/variables/variable-types.md b/content/v2.0/visualize-data/variables/variable-types.md index dc607959a..a7bbcb117 100644 --- a/content/v2.0/visualize-data/variables/variable-types.md +++ b/content/v2.0/visualize-data/variables/variable-types.md @@ -17,10 +17,19 @@ Variable types determine how the list of possible values is populated. ## Query Variable values are populated using the results of a Flux query. +All values in the `_value` column are possible values for the variable. + +##### Variable query example +```js +// List all buckets +buckets() + |> rename(columns: {"name": "_value"}) + |> keep(columns: ["_value"]) +``` + +_For examples of dashboard variable queries, see [Common variable queries](/v2.0/visualize-data/variables/common-variables)._ - -{{% note %}} #### Important things to note about variable queries - The variable will only use values from the `_value` column. If the data you’re looking for is in a column other than `_value`, use the @@ -30,6 +39,4 @@ Variable values are populated using the results of a Flux query. - The variable will only use the first table in the output stream. Use the [`group()` function](/v2.0/reference/flux/functions/built-in/transformations/group) to group everything into a single table. -- Flux doesn’t let you have unbound queries so you have to have a timeframe on a query (range function). want to keep your range fairly limited. - Do not use any [predefined dashboard variables](/v2.0/visualize-data/variables/#predefined-dashboard-variables) in variable queries. -{{% /note %}} diff --git a/content/v2.0/visualize-data/variables/view-variables.md b/content/v2.0/visualize-data/variables/view-variables.md index 491381eae..6af47daa5 100644 --- a/content/v2.0/visualize-data/variables/view-variables.md +++ b/content/v2.0/visualize-data/variables/view-variables.md @@ -28,3 +28,5 @@ View a list of dashboard variables in the InfluxDB user interface (UI) from an o 2. Switch to **Script Editor**. 3. Click the **Variables** tab to the right of the script editor. + + {{< img-hd src="/img/2-0-variables-data-explorer-view.png" />}} diff --git a/static/img/2-0-variables-data-explorer-view.png b/static/img/2-0-variables-data-explorer-view.png new file mode 100644 index 000000000..74a18c69d Binary files /dev/null and b/static/img/2-0-variables-data-explorer-view.png differ