Hi I am trying to make dashboard more flexible. My query is below

Line1 SELECT date_trunc(’{{interval}}’, finish_time) datehour,
Line2 count(0) COUNT
Line3 FROM saturnv.d_jobs
Line4 WHERE job_last_state=‘TASK_LOST’
Line5 AND created_time >= NOW() - INTERVAL ‘{{range_of_query(day)}}’ DAY
Line6 AND cluster_id {{ optr }} {{clusterID}}
Line7 GROUP BY date_trunc(’{{interval}}’, finish_time)
Line8 ORDER BY datehour ASC

Everything is okay with parameters except for opt and clusterID. I used query based dropdown list for both.

List for opt is = or > or <
List for clusterID is some number(444,323,233)

What I am trying to achieve is make this Presto query flex by changing theses values on dashboard. For an exammple, I want to show all data belong to any clusterID, but some times want to show data only belong to clusterID=444 or sometimes shows data only clusterid greater than 323. But I am running into below error.

Error running query: line 6:18: mismatched input ‘&’ expecting {<EOF>, ‘.’, ‘[’, ‘GROUP’, ‘ORDER’, ‘HAVING’, ‘LIMIT’, ‘AT’, ‘OR’, ‘AND’, ‘IN’, ‘NOT’, ‘BETWEEN’, ‘LIKE’, ‘IS’, ‘UNION’, ‘EXCEPT’, ‘INTERSECT’, ‘=’, NEQ, ‘<’, ‘<=’, ‘>’, ‘>=’, ‘+’, ‘-’, ‘*’, ‘/’, ‘%’, ‘||’}

Hi! Try to use three curly braces for optr: {{{ optr }}}

1 Like

The proper fix for this is coming: https://github.com/getredash/redash/pull/3058

1 Like

It works. Thanks…