Filters on a text variable using LIKE '%%'


#1

I’ve been playing around with filters and tried to filter a text variable to find all elements that matched partially the text input. I tried different variations of ‘[[WHERE text_column LIKE ‘%{{text_variable}}%’ ]]’ but I couldn’t make it work. Is this actually possible (if so, please enlighten me :slight_smile: ) or is there a reason why it can’t be done?

Thanks


#2

I am also having this problem. If anyone else knows proper syntax to make this work I’d love to hear it.


#3

yeah me too! Just tried to do it with the latest update, no dice.

If the text field is {{text_here}} and then you use the regex command in the provided box it will work, but that’s a pain for non-technical users :confused:


#4

Figured it out!

Created from Member 
        where ReferredBy is not null
        and ReferredBy like "%"{{referrer}}"%"

That adds regex commands into the output.


#5

This does not seem to work for me. Still trying to figure it out.


#6

Works for me on 0.22, thanks!


#7

Another solution, try to use CONCAT(’%’,{{variable}},’%’) such as:

WHERE 1=1
[[ AND test LIKE CONCAT(’%’,{{variable}},’%’) ]]


#8

this works for me, also with multiple variables like that in on query. Thanks!!


#9

[[where text_column LIKE ‘%’ || {{text_variable}} || ‘%’]] works for me on Redshift


#10

[[ AND name LIKE ‘%’||{{variable}}||’%’]]