Unable to execute query due to variables not decoding

49 Views Asked by At

i am using grafana 10.0.0v

i am getting sql query from a mysql table which i am storing in a variable and when i use the variable it should trigger the query present in the variable,it is working fine if it doesnt have any variables in the returned query,but if it has variables then it is not decoding the value instead it is passing the variable name itself to the query

query saved in mysql table is

SELECT timeStamp AS time,CAST($best_cell_mro_kpi AS DECIMAL(20,5))*100 as MRO_KPI FROM lab_mro_aggr_data_new WHERE $__timeFilter(timeStamp) and clusterID=''$best_cell_clusterID'' and $best_cell_ecgiID is not null and $best_cell_mro_kpi is not null ORDER BY timestamp

i am storing this in a variable called best_cell_cdf and this variable i am using in the query panel as ${best_cell_cdf:raw}

SELECT timeStamp AS time,CAST($best_cell_mro_kpi AS DECIMAL(20,5))*100 as MRO_KPI FROM lab_mro_aggr_data_new WHERE timeStamp BETWEEN FROM_UNIXTIME(1695637351) AND FROM_UNIXTIME(1696242151) and clusterID='$best_cell_clusterID' and $best_cell_ecgiID is not null and $best_cell_mro_kpi is not null ORDER BY timestamp

when i run the query $best_cell_mro_kpi,$best_cell_ecgiID and $best_cell_mro_kpi should be replaced with actual values of variables which are already present in the dashboard

i want to get the actual variable values in place to execute query,how do we do it

0

There are 0 best solutions below