Can I use a variable to select measurement name based on a regular expression?

I am dumping switch data into an InfluxDB database. This is going in based on the switch model - currently I have two models, and multiple switches under each. The tags for each model are the same.

My measurements and tags look like this (with a truncated list of tags):

us24
   - name
   - mac
   - port_idx
us24poe250
   - name
   - mac
   - port_idx

Both have the same tags. There are two models though - us24 and us24poe250.

My goal on the dashboard is to be able to have a single variable - name - that allows users to select a device to see information about. Unfortunately, it looks like I need to create two variables, one for each measurement:

  • nonpoe - SHOW TAG VALUES FROM "us24" WITH KEY = "name"
  • poe - SHOW TAG VALUES FROM "us24poe250" WITH KEY = "name"

Is there a way that I can combine these to a single variable? I’d love to be able to select name and it will appropriate query the right measurement.

For example if I have two switches that are us24 with names switch1 and switch2 and two switches that are us24poe250 with names switch3 and switch4, if I select name = switch3, then the us24poe250 measure is queried. But, if I select name = switch2 then us24 is used?

In this case, there’d only be a single option for the user to select - name.

I’m looking for this as well. Did you manage to achieve it?