Documentation Controls and Variables FAQs

Use key-value pairs in a Dropdown

Let’s say you have created a Dropdown to filter your charts by Activity Id. Often times, users will want to select the Activity Id’s associated Activity Name from the dropdown instead of having to use the Activity Id. Some identifying information is not known or useful to some users.

This type of situation is likely a use case for the key-value pair. Key-value pairs are sets of two linked pieces of data. The key is the unique identifier in the data set and the value is either the data itself or a pointer to the location of the data. For use with a Chartio Dropdown environment variable, the key is a unique ID and the value is the easy way for a user to identify the key.

Here’s how you do it:

In the Visual SQL interface

To create a Dropdown with a key-value pair, you can simply open your Dropdown for editing and add the more useful second column to the Columns section.

The first column’s values are used to filter charts, and the second column are the values displayed.

For this example, we use our Document Company Demo Data data source. Using the Organization table from the Digisign2 schema, we want to display Organization Name values in the Dropdown and filter by their associated ID. Here’s what how we’d set that up:

Set up a key-value pair in a Dropdown

When setting key-value Dropdown default values or report values, use the key (first column), not the value (second column).

Some potential use cases for using a key-value pair include when ID number information is not useful to the dashboard user. Often times a dashboard may be accessed by users that have little experience and no reason to know the numerical structure of the ID numbers for your client base. This would be a great time to use a key-value pair to identify the Client by their name, email, or some other more useful identifying piece of information.


In the Data Explorer interface

To create a Dropdown with a key-value pair, you can simply open your Dropdown for editing and drag the more useful second column to the Dimensions section.

The first column’s values are used to filter charts, and the second column will be the display values.

To display Activity Name values in the dropdown, and filter by their associated Activity Id, this is what our preview looks like:

Set up a key-value pair in a dashboard dropdown

When setting key-value dropdown default values or report values, use the key (first column), not the value (second column).

Some potential use cases for using a key-value pair include when ID number information is not useful to the dashboard user. Often times a dashboard may be accessed by users that have little experience and no reason to know the numerical structure of the ID numbers for your client base. This situation would be a great time to use a key-value pair to identify the Client by their name, email, or some other more useful identifying piece of information.