I'd like to apply a filter to an SQL query if and only if another filter is not set. This would look something like:
WHERE true
[[AND status = CASE WHEN COALESCE({{special_cases}}, 0) = 0 THEN {{status}} ELSE status END]]
i.e. apply the {{status}}
filter on the status
column if and only if the {{special_cases}}
filter is not set.
In this form the filter is ignored entirely. BTW how is the optionality [[...]]
evaluated with more than one variable present?
Any ideas are welcome,
Marton