Base a variable value on another variable value (like IF or Label on value)

Hi everyone,

I struggle with a variable configuration and I’m not sure there’s actually an answer to that.

I have a variable (let’s call it $db_value) which is used for making querries on some panels on a Postgresor Prometheus DB - that is OK. The only thing is that this $db_value variable is not meaningful.

Let’s assume the possible values of the variable $db_value are:

I see two possible solutions to “translate” these not meaningful values to something else:

1. Another variable with IF condition

The idea would be that I create another variable, called $meaningful_value, with values:
meaningful_value_1 (that corresponds to db_value_1)
meaningful_value_2 (that corresponds to db_value_2)

And I would like to write something like:
IF $db_value = db_value_1 then $meaningful_value = meaningful_value_1
ELIF $db_value = db_value_2 then $meaningful_value = meaningful_value_2

But I have any idea on how to do it - any help?

2. With a label on variable value

I’ve seen we can label variable name to make it more understandable, but in that case I would like to label the variable value itself and I want this label to appear in the dashboard dropdown list.
Assuming we know what will be the exhaustive list of values of our $db_value variable
Is it possible?

Thanks a lot for your help !

I would have exactly the same need! Does anybody out there have any clue how to achieve this? :slight_smile: