Serialized Multi-Select with select All

Serialized Multi-Select with select All

Hi,

I’ve set Query based dropdown list (countries and medium) with Multi-Select and Single quotation marks for my main query:

select date, count(downloads)
from reports
where date between '{{ date_start }}' and '{{ date_end }}'
and country in ({{ Country }}) 
and medium in ({{ Medium }})
group by date 

I’ve reffered to

SELECT 'All' as chart_type
UNION ALL
   (SELECT DISTINCT country AS chart_type 
   FROM report
   ORDER BY chart_type ASC)

for selection ‘All’ (default) of these values, but I get an
Error running query: Code: 27, e.displayText() = DB::ParsingException: Cannot parse input: expected ‘(’ before: ‘All’: while converting ‘All’ to Tuple(String, String, String)

Are there possible ways/SQL query to toggle for All ?
Any help would be greatly appreciated.

Technical details:

  • Redash Version: Version: 8.0.0+b32245 (a16f551e)
  • Browser/OS: Chrome

For the select-all behaviour to work your query should look like this:

select date, count(downloads)
from reports
where date between '{{ date_start }}' and '{{ date_end }}'
and ('All' in ({{ Country }})  or country in ({{ Country }})) 
and ('All' in ({{ Medium  }})  or medium  in ({{ Medium  }}))
group by date