How to select a variable index

Hi all,

Really sorry but was hoping someone could explain to me how I am able to select from a list of multiple variables in a query so that I only return a single variable in position 1,2,3 or 4 from the example below:

variable_name contains the following values
AAA
BBB
CCC
DDD

I tried indexing it using the following format but this doesnt seem to work.

WHERE MY_VALUE = {variable_name:1} OR
WHERE MY_VALUE = {variable_name:3}

I have looked at the documentation and here on the community forums but I am either going blind or it is just something that isnt supported?

Any help would be greatly appreciated. Loving Grafana so far!

3 Likes

Wondering if there were any updates that allowed this behavior. I’m using a plugin where I make multiple requests to a JSON API and would like to save some object ids in a variable. When writing the path to requests in queries, I would like to use this variable like this:

A:
/path/to/api/object/${object:0}

B:
/path/to/api/object/${object:1}

Instead of : you can use . ${object.0}

2 Likes