Nested variable evaluation

Hello, I know it is not supported, but can anybody help me with a some workaround?

I need to select a tag in a influxDB query according to the ${__user.id}. But the tag is something like ‘server1’. I was thinking of having variable userid1name = server1, that would be evaluated from ${userid${__user.id}name}. Actually this sometimes work, some times does not. Working with grafana 10.1.9. What would be your suggestion to make this always working? Thanks a lot

Under which conditions it does not work? Do you also have a userid in InfluxDB as a tag?

let’s define variables:
${__user.id} value is 24
${userid24name} value is server1
It always works in influxDB query - it is always correctly evaluated
from “${userid${__user.id}name}” to “server1” variable value

However in other occassions like panel title, pane description, transformation expressions, querry expressionis etc. it is not completely evaluated. It only goes
from “${userid${__user.id}name}” to “${userid24name}” string

It works only in InfluxDB queries, it does not work for panel title, panel description, transformation expressions, querry expressions.

I cannot use userid itself as a tag, because I need to select more tags with one userid.

Thanks for your help

This “really ugly workaround” helped me to solve the problem with nesting variable ${__user.id}: Access to the value of a custom variable key:value from another custom variable value - #6 by sowdenraymond

1 Like

glad this worked for you!