How to use like with a templated filter

  • 1 December 2022
  • 1 reply

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. 

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?


Best answer by smittywerben 1 December 2022, 03:52

View original

1 reply

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