My question about variables. Does Grafana support drilldown variables? I mean when i choose or select option/field on one variable. And other variable can change automatically/properly depend of data of course. Like a master detail relationship. e.g continent, country
And another question is the correct way to usage of variable like hard coded where clause for MS Sql server ?
How do you deal with the all value of option in the variable. lets assume we have a variable and it has distinct values and all option. like continents in the world. But my query stuck when i choose the all option.
My query hard coded query looks like
select
time,
metric,
value
from table
where column1 IN (@variable1)
of course i am having a problem with value of variables. when i select the all option my query doesn’t work.
WHERE ColumnName IN ($variable) output of this -> WHERE ColumnName IN (’’)
this query getting empty resultset because of ‘’.
My Main questionis : Can Grafana handle T-sql query’s where clause. If i select all option grafana remove "ColumnName IN ($variable) "
IF i select one or more option in the variable everything works well.
I did with this where clause I setted the value of custom all values ‘’. My main problem is t-sql oriented. if i select all option grafana sets empty as a value, otherwise when i select multiple value grafana gives me comma seperated values list such as ‘val1’,‘val2’ then i couldn’t use this these two kinds of different things.
case 1 => ‘val1’,‘val2’
case 2 =>
this is really blank nothing in it.
You know SQL server uses ’ character for string then i have to handle both empty thing and comma seperated values at the same time. Finally i solved with the CONCAT function for this limitations.
CONCAT can concatenate many comma seperated values as a built in function in SQL Server .
WHERE
((LEN(CONCAT($Unvan,‘’))=0) OR UNVAN IN ($Unvan))
You still haven’t told me what Grafana version you’re using. On latest master (commit 25ea5fc) using Postgres (but should be same for MySQL) I get the following result using All event types:
I using MSSQL
I having the same Problem my Data Source marked below by $Database is working fine when embed in SQL as shown below but when pass variable Query based it failed my version of Grafana is Grafana v5.2.4 (0bbac5c)
The SQL is
DECLARE @StartDate datetime = $__timeFrom(), @EndDate datetime = $__timeTo()
SELECT Count(* ) as ‘Total Runs’, ‘$Database’ as ‘Project’,‘$App’ as ‘Application’
FROM (RUN.RN_EXECUTION_DATE BETWEEN @StartDate and @EndDate )and
RUN.RN_STATUS Not in (‘No Run’, ‘N/A’, ‘Not Completed’, ‘’) and RUN.RN_DRAFT in (‘N’) and RUN.RN_USER_TEMPLATE_02 in (‘$App’)
Hello. I have the same problem
How to use parameter from parameter, for example,
1parameter- $par1 = select top 100 Product from Products
2parameter- $par2 = select top 100 * from Customer as C Where c.Product=$par1
(in Microsoft Report builder its 2parameter- @par2 = select top 100 * from Customer as C Where c.Product=@par1 and it will work, how can i do the same in Grafana)