How can I use a variable as the value for another text or custom variable?

According to the manual, where custom variables are explained:

  1. In the Values separated by comma list, enter the values for this variable in a comma-separated list. You can include numbers, strings, other variables or key/value pairs separated by a colon.

However, I’ve tried to enter my variable in multiple formats in the text box of the new variable but it’s always taken as a literal text.

Formats tried:
$myVar

myVar

${myVar}

Any ideas?

Thanks in advance.

Hi,

Which version are you using, there was similar case fixed in 7.3.4.

Did you try using $myVar

1 Like

Thanks for your response. Version is 7.3.6. I did try with $myVar.

Hi,

I didn’t find any use case without the use of a datasource, as you see in this example you can use your variables using $var but it must be coming from a datasource :
https://play.grafana.org/d/000000056/graphite-templated-nested?editview=templating&orgId=1&var-app=country&var-server=All&var-interval=1h

So you can either create two tables on your datasource and link them by id or name. And then you can use them as in the example here.

Hope it helps.

Good Luck

Thanks again @wlargou for your reply.

I’m already inserting variables in other variables with queries. I was just trying to do so on simple text or custom variables.

Have you checked the documentation on Chained variables?

Yes but those examples refer to the use of variables in queries. I’m primarily interested in inserting variables in text and custom variables.

Thanks!

2 Likes

This topic was automatically closed after 365 days. New replies are no longer allowed.