Hi @jgrueso
Here’s an example of what I mentioned earlier. This is a case from my dataset and you need to adapt it to your case.

The IN(NULL, … ) case in my screenshot addresses the situatio where the Select All is done by the user in the parameter.
Similar to this you can have a boolean result (1, 0) come out of your ifelse and the where clause only looks for where the result = 1 (True) to filter your records.
Regards,
Giri