I have created a Field value using Variables in Grafana dashboard and passed by data link .
I am able to pass it in the URL but i want to access the same in the Mysql Query
I am trying to achieve a Drill down mechanism.
And want to pass that filter(from the URL) in the child Dashboard panel
Sample : http://localhost:3000/d/E8oz3cMGk/drilldown?editPanel=6&orgId=1&from=1593764427317&to=1593786027317&viewPanel=6&p=sampleFeild
I want to use value of ‘p’ in my MySql Query
Query : - Select client_id from sampleTable where feild = ‘$p’ limit 10
i am not able to set the value from URL to the feild variable in Query.
Thanks in Advance
Facing the same issue here, have you found a solution?
Did you find the solution?
It took me a while to figure this one out - it is not straight forward at all.
Let’s assuming you have a parent dashboard, and you want to create a datalink to a drill down dashboard. Let’s further assume that the variable you are concerned with is called “ticket_num”.
In your parent dashboard, you would simply create a datalink to: http://[YOUR_URL]:3000/d/[YOUR_DRILLDOWN_DASHBOARD_URI]/[YOUR_DRILLDOWN_DASHBOARD_NAME]?var-ticket_num=623
Notice the var- before ticket_num. In your drill down dashboard, go into settings and select Variables. Create a new variable named ticket_num, type = Constant, label = whatever you want, description = whatever you want, value = “blank” (it can be whatever, you just have to enter something). Click update and save the dashboard.
Then, in your query, you would simply reference the variable with a $ sign. Such as:
SELECT * FROM table WHERE ticket_num = $ticket_num