-
What Grafana version and what operating system are you using?
10.2.0 -
What are you trying to achieve?
I have a panel with two tables and some template variables.
The variables are for group and category.
The first table shows aggregate data by group and category -
FRUIT/APPLES, 500
FRUIT/MELONS, 50
VEGES/POTATOES, 100
VEGES/ONIONS, 100
The template variables are for group and category as well, with the category being dependent on the group. FRUIT -> APPLES, MELONS, VEGES-> POTATOES, ONIONS
etc…
The second tables, shows a breakdown of the values in the category selected in the template variables:
(FRUIT, APPLES,) 'Granny Smith', 200
(FRUIT, APPLES,) 'Pink Lady', 300
(FRUIT, MELONS,) 'Watermelon', 30
(FRUIT, MELONS,) 'Rock', 20
(VEGES, POTATOES,) 'Red', 60
(VEGES, POTATOES,) 'Blue', 40
(VEGES, ONIONS,) 'Brown', 70
(VEGES, ONIONS,) 'Red', 30
The second table only shows data for the selected group and category.
I’m trying to set things up such that if I click on a row in the first table, the template variables and the second table will switch to showing data for the matching group/category. If I click on FRUIT/APPLES in the first table, the second should show data for the different types of apples, if I click on the row for VEGES/ONIONS the second table should show data for different types of onions.
-
How are you trying to achieve it?
I’ve set up a datalink for the first table that redisplays the same panel, specify field values for the template variables:
…
d/stores/stores?orgid=1&${__url_time_range}&var-group=${__data.fields.GROUP}&var-category=${__data.fields.CATEGORY}
…
This gives me a clickable hyperlink that changes the template variables and thus the contents of the second table. -
What happened?
Most of the time it works, but sometimes it doesn’t.
What I think I’m getting is that changing the group value is causing a refresh of the valid category values - and sometimes this is overwriting the category value from the data link that is passed in with the first category value that’s in the group. (or, maybe, the category from the data link is being ignored because it’s not valid in the previous group). The query to get the valid categories for the group isn’t instantaneous - it takes, maybe, 0.2 of a second. I’d like to keep the query so users can manually change the category (and the group).
- The data link is called with var-group=FRUIT,var-category=MELONS.
- The query to find the valid categories for FRUIT is run.
- Sometimes the category ends up as MELONS, Sometimes it ends up as APPLES
I sometimes end up on a page where the URL and the variables are mismatched:
localhost:3000/d/store/store/var-group=FRUIT,var-category=MELONS
But the variables are set to FRUIT and APPLES.
When this happens, clicking on the data link again, produces no action - presumably because it thinks we’re already there.
- What did you expect to happen?
The template variables should always end up with the values passed on the data link.
-
Can you copy/paste the configuration(s) that you are having problems with?
Not easily. -
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
Nope, no errors. -
Did you follow any online instructions? If so, what is the URL?
Nope, flying solo here.