Template variable that is an enumeration of combinations of other template variables?


Is there a way to define a template variable as an enumeration of the combination of the value in two other multi-select variables?

A sample use case might be that I have a variable holding a list of system names (variable system, possible values SYS1, SYS2, SYS3, SYS4) and a variable holding a list of processor types (ptypes, possible values CPU, GPU).

What I’d like in the enumeration variable would be a list of all of the combinations of the selected values from each list. If system was set to SYS1 and SYS3 and ptype was set to CPU and GPU, then the enumeration variable would have values SYS1-CPU, SYS1-GPU, SYS3-CPU, SYS3-GPU.

Usage would be organizing panel replication.

are these system names and cpu types coming from a data source dynamically or are they hand carved static list?

The more critical question is how do you intend to use these cross apply results

They are all coming from an SQL database, in different columns. I’m using chained dashboard variables to pull them down as multi-select template variables. Users get one dropdown to select the systems and a second to select the processor types. Potentially there are 50+ system and 4 or 5 processor types - although I’d hope no-one would try and show them all at once.

I’d be planning to use the expanded list to repeat a panel, so we get one panel per system/processor type combination. At present I’m just using the system name to repeat the panel, so I’m getting one panel replica per system.

It’s fine using just one processor type, by it gives some rather confusing graphs when both processor types are selected:

One line is CPU and the other is GPU - but which is which? Neither breaches the 80% threshold, so they are both green…

My best idea for fixing this is to separate them onto separate panel replicas (one for CPU and one for GPU), my second is going to be to disable the threshold based coloring :frowning:.


1 Like

It does not seem like the Repeat functionality works when you use a third variable that is a combination of two others?

I choose multi combo and it results in this

But there is one panel nothing is repeated.My third variable query looks like this

select concat(s.name, '-',c.name) as combi
  from systems s
  cross apply cputypes c
where s.name in (${systems:singlequote})
and c.name in (${cputypes:singlequote})

But if you create only one variable with following query

select concat(s.name, '-',c.name) as combi
  from systems s
  cross apply cputypes c

you get what you are looking for.

Thanks, that’s quite informative.

Looks like repeat is looking for time series qualified by the repeat variable value.

I ended up putting the panel is a row, repeating the row by system and then repeating the panel by ptype. Seems to be working…


1 Like