How to use like with a templated filter

I’d like to do something like this:

 select  * FROM table
  where  {% condition topic %} ILIKE title {% endcondition %} ;;

  filter: topic {
    type: string
  }

where the Topic comes from user input. 

Ex:
I’d like my user to be able to enter in “Mark” and find all Titles containing “Mark” (case-insensitive). 
 

Right now, when I remove the ILIKE, I am able to only enter in the entire Title to get the result.
Ex. When I enter “Mark” into the topic, I am returned nulls, when I enter “Mark’s Adventure” I am returned with the Title/accompanying data.

Would using a parameter be a better option here?

Solved Solved
0 1 161
1 ACCEPTED SOLUTION

Answer here for those who may need it:

where title ilike concat('%',{% parameter topic %},'%')

Keep the filter field = to ‘filter’. Do not change it to parameter. idk but it worked

View solution in original post

1 REPLY 1

Answer here for those who may need it:

where title ilike concat('%',{% parameter topic %},'%')

Keep the filter field = to ‘filter’. Do not change it to parameter. idk but it worked

Top Labels in this Space
Top Solution Authors