I have mapped values in my Grafana Dashboards as shown in the following Link:
https://grafana.com/docs/grafana/latest/panels-visualizations/configure-value-mappings/
For example:
Variable is called Name
and it contains the values 1,2,3,4,5
from the Database.
The mapping is as follows:
1 - Name1
2 - Name2
3 - Name3
4 - Name4
5 - Name5
I have applied the settings of that panel and saved the dashboard.
But in the dropdown Name, i still see the numbers instead of their mapped values (Name1, Name2, etc.)
Does anyone know why this is occuring and if i need to do something in addition for that matter ?
Thanks in advance :)
To anyone interested:
I was creating the variable using a SQL Query
. In order to map the new values as desired, the variable must be of the type Custom
.
Inside the Custom options
it is required to map the values with the scheme myKey : myValue
and if multiple, they need to be separated by a comma.
For example:
Name1 : 1, Name2: 2, Name3: 3, Name4: 4, Name5: 5
Now in the Dropdown of the Variable Name it will be shown a list consisting of Name1, Name2, Name3, Name4, Name5
. But when the variable Name is used in the SQL query of the Dashboard (ex. ... WHERE name = ($Name) ...
), the number corresponding to that Name will be selected (1 for Name1
).