Wrong query variables

Hi all,

question: you all might answer in a couple of seconds, but gets me frustrated. I’m using grafana 8 with an influxdb datasource.
I’m trying the query data with a dashboard variable. (dashboard variable called BATCHID)

the query in the panel is: SELECT max(“WT1062.DrumCount.DrumNr”) FROM “opcua” WHERE (“MBR-R3.MBR-Dryer.BatchNo” = ‘$BATCHID’)
So I’m looking for a max value from a tag where the Batch number matches the dashboard variable. somehow. it keeps giving me NO DATA. and I know why, but I cannot fix it.

the query result in the query explorer is:
“SELECT max(“WT1062.DrumCount.DrumNr”) FROM “TEST”.“autogen”.“opcua” WHERE (“MBR-R3.MBR-Dryer.BatchNo” = ‘(109FF27)’)”

but it should not be: ‘(109FF27’) but ‘109FF27’. I use a similar query in the same dashboard which does give the correct value…

SELECT cumulative_sum(“DI1091.dDT1091.PV”) FROM “opcua” WHERE (“MBR-R3.MBR-Dryer.BatchNo” = ‘$BATCHID’) AND (“C3200Production2019.BF.StepNr” > 9) AND (“C3200Production2019.BF.StepNr” <50)

query inspector:
SELECT cumulative_sum(“DI1091.dDT1091.PV”) FROM “opcua” WHERE (“MBR-R3.MBR-Dryer.BatchNo” = ‘109FF27’) AND (“C3200Production2019.BF.StepNr” > 9) AND (“C3200Production2019.BF.StepNr” <50)

anybody any idea???

Many thanks,

i think you have the “all” option enable in your variable BATCHID
this will add some quote to your variable in order to permit you to query with muti value syntax :
where Dryer.BatchNo in (‘109FF27’,‘value2’)
check this :

Thanks Alexandrearmand! that did it.

But I don’t understand why 2 similar queries respond differently.
Anyhow it is solved. only single values is perfect in my case!