If/Else code execution based on filter value - Redash

233 Views Asked by At

I would like to check if it is possible to use Redash filter parameters to turn on/off code in my Presto query.

Sample code I tried: shown below. Basically, I want to union queries only if the filter value is 'a'.

select 1 col
{% if '{{dummyfilter}}'='a' %} union select 100 {% end %}

Error shown: Error running query: line 2:1: mismatched input '{'. Expecting: ',', 'EXCEPT', 'FETCH', 'FROM', 'GROUP', 'HAVING', 'INTERSECT', 'LIMIT', 'OFFSET', 'ORDER', 'UNION', 'WHERE',

0

There are 0 best solutions below