GitHub user Hen0k added a comment to the discussion: Modify Automatic “IN” 
Filter to Support “LIKE” Search for Categorical Filters

@chrisdukeLlama 
I had a similar requirement a while back and found a workaround that I have 
been using.
This will require you to enable template processing using the feature flag.
      'ENABLE_TEMPLATE_PROCESSING': True,

Another thing to note is that the solution only works on Virtual Datasets. You 
can easily satisfy this one.

Then you use jinja to replace the filtering login applied on that dataset like 
this.


```sql
SELECT * FROM your_table

{% if filter_values("your_column_name") %}
  WHERE 
  {# Initialize a variable to store the conditions #}
  {%- set or_clauses = [] -%}
  
  {# Loop through each filter in the 'your_column_name' filter #}
  {%- for filter in get_filters('your_column_name', remove_filter=True) -%}
  
    {%- if filter.get('op') == 'IN' -%}
      {# Loop through all values in the filter #}
      {%- for val in filter.get("val") -%}
        {# Append each condition to the list #}
        {%- set _ = or_clauses.append("your_column_name ILIKE '%%" ~ val ~ 
"%%'") -%}
      {%- endfor -%}
    {%- endif -%}
  
  {%- endfor -%}
  
  {# Join the list of conditions with 'OR' to form the final clause #}
  {{ or_clauses | join(' OR ') }}
{% endif %}
```

GitHub link: 
https://github.com/apache/superset/discussions/33625#discussioncomment-14634247

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to