How to input multiple values for Text filter in SQL

Hi

I have created a native query with a text filter as follows and created a text filter type for {{input}} mentioned in below query.

Select Textfield , field2, field3
from Table1
where Textfield in ({{input}})

Even though i have used ‘in’ in my where clause, i’m unable to provide multiple values as input. The filter works fine if it is on type numeric.

Can anyone let me know if i’m doing something wrong

Hi @Pradeep.Doddarangaia
Yes, because {{input}} variable is converted to 'some,multiple,values' so your database is just reading it as one string. You’ll need to split that manually - see this issue for workaround in the example:
https://github.com/metabase/metabase/issues/4728 - upvote by clicking :+1: on the first post
Or use Field Filter:
https://www.metabase.com/docs/latest/users-guide/13-sql-parameters.html#the-field-filter-variable-type

Thanks @flamber

Tried a work around and below query works for T-SQL

Select Textfield , field2, field3
from Table1
where Textfield in 
 (SELECT value FROM STRING_SPLIT({{input}},','))
1 Like

Hi

I have been battling this on MariaDB and finally found the solution that worked for me:
("%"{{name}}"%")

6 posts were merged into an existing topic: How to input multiple values for Number filter in MySQL