I’ve got a repeating row in my dashboard that is repeating by an ‘id’ value, but I would like to display the ‘name’ value instead. I can use the ‘id’ to lookup the ‘name’, but it’s not working within the row name/description. Any suggestions?
Make the variable a key,value pair and then use the id for looping and text for display
Or just the text associated with id unless id is used in some filter?
Thanks, that’s kinda where I was leaning but good to hear it as a recommendation.
How do I extract one part of the variable when putting it in the row name?
i.e. if I end up with id_name = {“id1234”:“customer_name”}, how do I extract “customer_name” in the row? I’m only familiar with using the whole variable like “${id_name:raw}”
Thanks
${var1:text}
to access a key and ${var1:value}
to access value. I think
Thanks for your quick help here but it doesn’t look like that’s working. With that syntax, I get the full value for both “:text” and “:value”. FWIW, I’m constructing a JSON object from a SQL query so I might need some assistance lining up that syntax correctly
please post sample data and json and query as we do not have remote access to your monitor
Apologies, I didn’t see your reply! Here are some screenshots of how I have it setup:
My query:
Preview of values:
In the repeating row options:
As you can see in the background, I am trying to just show the ‘id’ in the repeating row but it is always selecting the whole variable. Thanks in advance!
grafana takes care of doing the key value thing for you so not need to do the jsonized kind of data. see this documentation on how to get what you need
SELECT hostname __text, id __value FROM host
kind of thing
Thanks, that definitely looks like what I want to do, but for some reason I’m still not getting things to line up properly.
I have my variable returning a ‘__text’ and a ‘__value’, but I’m not seeing the text+value pair in the drop-down, and when I put ${var:__value} in the row name, it’s only showing the first part (the __text)
look at your query again carefully as to which value should __text (string) and which value should be __value (integer)
Thanks. I thought the docs said that “text” had to be unique. They’re both “strings” in my data, I just want to be able to repeat the row based on the ID (__text), and show the Name (__value) in the row description
I was mistaken on __text (string) and which value should be __value (integer)
meant to say
__text (value) and which value should be __value (key) for key/value pair.
try ID (__value), and show the Name (__text)
Thanks for your continued help here, but whichever way I put it, I’m only ever getting the ID in my repeating row.
Okay, thanks for your continued help here. The docs clearly state: “The options in the dropdown will have a text and value that allow you to have a friendly name as text and an id as the value.”
I’ve got the name showing up properly in the repeated rows…but now how do I access the “value” within my queries?
That’s not working