Variable not working

Hi,

Till yesterday afternoon variables are working fine in grafana with Influx as the backend data source. The query is as below

from(bucket: “bucketname”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn:(r) =>r[“_measurement”] == “measurement”)
|> last()
|> group()
|> keyValues(keyColumns: [“column1”])
|> drop(columns:[“_tag1”])

But from yesterday evening the above query is not working. I have data in that measurement. I am using Influx 2.1 version. Can anyone help me why this is happening

Regards
Sudheer

Is that the query to get the variable values on Grafana? or are you using variables from Grafana in that query? .

If the intention was the second one, then I am not seeing any variable being referenced in that query.

Hi,

The above query is used in grafana to get values into variable from influxdb and use it in grafana report

Regards
Sudheer

Hello @AVVS_Sudheer,
That might be more a question for https://community.grafana.com/ then :slight_smile:

Hi,

Now this query is working fine. I have tried diff methods and at last one method has worked. At first in the new grafana dashboard, we have to set the time range to 1 year and then create a variable.it will work. As in the variable we have start and stop range

Regards
Sudheer

Oh, I think I know where your confusion is coming from.

when you use |> range(start: v.timeRangeStart, stop: v.timeRangeStop) as yo do in influxdb’s data explorer.

in Grafana dashboards. it will translate both variables to the time values selected in Grafana time picker:
image

v.timeRangeStart and v.timeRangeStop are both variables from the time picker in both software

If you need specific time ranges either select the range using the time pickers or hard code the values like you did

Hi,

Thanks for your suggestion. I tried that way by giving the date range. It is working fine now

Regards
Sudheer