I have a dashboard with a template variable ERROR_TYPE that can have values of A, B, or C. I have enabled multi-select and All
options.
I have a Snowflake query with a WHERE clause that contains:
WHERE error in (${ERROR_TYPE:singlequote})
That works just fine. When I pick the All
option in the pick list then this SQL.
WHERE error in (${ERROR_TYPE:singlequote})
expands to this SQL:
WHERE error in ('A', 'B', 'C')
PERFECT!
I also have a drill down dashboard that I link to from this top-level one and the URL to the drill-down needs to pass the ERROR_TYPE values. I do this using something like:
https://grafana.net/d/be3ghs18jd8n4e?${ERROR_TYPE:queryparam}
When individual or multiple error types are selected, this works. The drill down URL looks something like this when the error types A
and B
are selected:
https://grafana.net/d/be3ghs18jd8n4e?var-ERROR_TYPE=A&var-ERROR_TYPE=B
PERFECT!
But, when I select the All
option in the pick list, the drill-down URL now looks like this:
https://grafana.net/d/be3ghs18jd8n4e?var-ERROR_TYPE=$__all
However, that $__all
ends up being an empty string when received in my drill-down dashboard. In the drill-down dashboard, I do have a template variable defined for ERROR_TYPE that receives the value from the URL query parameter. But, in the drill-down dashboard’s query WHERE clause where I use that variable, this:
WHERE error in (${ERROR_TYPE:singlequote})
expands to this:
WHERE error in ()
Which is invalid SQL.
What I was expecting to happen was, when I selected All
in the top-level dashboard pick list, all three error type values would be expanded into the data link’s query parameters, like:
https://grafana.net/d/be3ghs18jd8n4e?var-ERROR_TYPE=A&var-ERROR_TYPE=B&var-ERROR_TYPE=C
I have not worked a lot with data links like this and would greatly appreciate any help in making this work.
Thanks!