Solved

How to use like with a templated filter

  • 1 December 2022
  • 1 reply
  • 42 views

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?

icon

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

Reply