---
title: Variable types
description: Overview of the types of dashboard variables available in InfluxDB
url: https://docs.influxdata.com/influxdb/v2/visualize-data/variables/variable-types/
estimated_tokens: 2018
product: InfluxDB OSS v2
version: v2
---

# Variable types

This page documents an earlier version of InfluxDB OSS. [InfluxDB 3 Core](/influxdb3/core/) is the latest stable version.

#### API token hashing is enabled by default in InfluxDB OSS 2.9.0

Stronger token security: tokens are stored as hashes on disk, so a copy of the database file doesn’t expose usable tokens. Existing tokens are hashed on first startup and the original strings can’t be recovered afterward — **capture any plaintext tokens you still need before you upgrade**.

For more information, see [Token hashing](/influxdb/v2/admin/tokens/#token-hashing).

Variable types determine how a variable’s list of possible values is populated. The following variable types are available:

-   [Map](#map)
-   [Query](#query)
-   [CSV](#csv)

### Map

Map variables use a list of key value pairs in CSV format to map keys to specific values. Keys populate the variable’s value list in the InfluxDB user interface (UI), but values are used when actually processing the query.

The most common use case for map variables is aliasing simple, human-readable keys to complex values.

##### Map variable example

```js
Juanito MacNeil,"5TKl6l8i4idg15Fxxe4P"
Astrophel Chaudhary,"bDhZbuVj5RV94NcFXZPm"
Ochieng Benes,"YIhg6SoMKRUH8FMlHs3V"
Mila Emile,"o61AhpOGr5aO3cYVArC0"
```

### Query

Query variable values are populated using the `_value` column of a Flux query.

##### Query variable example

```js
// List all buckets
buckets()
    |> rename(columns: {"name": "_value"})
    |> keep(columns: ["_value"])
```

*For examples of dashboard variable queries, see [Common variable queries](/influxdb/v2/visualize-data/variables/common-variables).*

#### 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 [`rename()`](/flux/v0/stdlib/universe/rename/) or [`map()`](/flux/v0/stdlib/universe/map/) functions to change the name of that column to `_value`.
-   The variable will only use the first table in the output stream. Use the [`group()` function](/flux/v0/stdlib/universe/group) to group everything into a single table.
-   Do not use any [predefined dashboard variables](/influxdb/v2/visualize-data/variables/#predefined-dashboard-variables) in variable queries.

### CSV

CSV variables use a CSV-formatted list to populate variable values. A common use case is when the list of potential values is static and cannot be queried from InfluxDB.

##### CSV variable examples

```
value1, value2, value3, value4
```

```
value1
value2
value3
value4
```

## Use custom dashboard variables

Use the Flux `v` record and [dot or bracket notation](/flux/v0/data-types/composite/record/#reference-values-in-a-record) to access custom dashboard variables.

For example, to use a custom dashboard variable named `exampleVar` in a query, reference the variable with `v.exampleVar`:

```js
from(bucket: "telegraf")
    |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
    |> filter(fn: (r) => r._measurement == "cpu" )
    |> filter(fn: (r) => r._field == "usage_user" )
    |> filter(fn: (r) => r.cpu == v.exampleVar)  

```

**To select variable values:**

-   **In a dashboard:** Use the dashboard variable drop-down menus at the top of your dashboard.
-   **In the Script Editor:** Click the **Variables** tab on the right of the Script Editor, click the name of the variable, and then select the variable value from the drop-down menu.

*For more on using dashboard variables, see [Use and manage variables](/influxdb/v2/visualize-data/variables/).*

[variables](/influxdb/v2/tags/variables/)
