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.
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:
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.
For more information see our Dropdown dashboard variable documentation.