# Filtering bug with multiselect dropdown?

**URL:** <https://community.weweb.io/t/filtering-bug-with-multiselect-dropdown/14276>\
**Category:** How do I?\
**Created:** [October 31, 2024, 10:29am UTC](https://community.weweb.io/t/filtering-bug-with-multiselect-dropdown/14276 "2024-10-31T10:29:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![savannah](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@savannah](https://community.weweb.io/u/savannah)\
**Post date:** [October 31, 2024, 10:29am UTC](https://community.weweb.io/t/filtering-bug-with-multiselect-dropdown/14276/1 "2024-10-31T10:29:48Z")

</div>

Hi! I’m trying to filter using the supabase backend filters. I’ve had good luck using multiple layers of filters but am running into an issue and wondering if it’s a bug.

I have a variable that has school grade levels in it, and I’m using a multi-select drop down for users to be able to filter down to see only schools with relevant grade levels. I have tried three different ways of formatting the variable field to get it to work and I have the prob with all three approaches.

- As text field with KG:01:02:03:04:05 (for an elementary school in the US, for example)
- As a text field with KG, 01, 02, 03, 04, 05.
- As a tsquery field in supabase where it’s formatted as ‘kg’ | ‘01’ | ‘02’ | ‘03’ | ‘04’ | ‘05’ .

The idea is that when families select “KG” and “01” from the dropdown, the data is filtered to show only schools with those grade levels. The filter seems to be identifying the correct value, but the data set is ‘empty’ when I try to run the filter. When I test it, I get the following error:

* * *

stack: “TypeError: e.replaceAll is not a function at wt ([https://cdn.weweb.io/components/f9ef41c3-1c53-4857-855b-f2f6a40b7186/29660e1c-dd44-491c-8053-f233b75e9ec0/dist/manager.js:1:228487](https://cdn.weweb.io/components/f9ef41c3-1c53-4857-855b-f2f6a40b7186/29660e1c-dd44-491c-8053-f233b75e9ec0/dist/manager.js:1:228487)) at [https://cdn.weweb.io/components/f9ef41c3-1c53-4857-855b-f2f6a40b7186/29660e1c-dd44-491c-8053-f233b75e9ec0/dist/manager.js:1:227917](https://cdn.weweb.io/components/f9ef41c3-1c53-4857-855b-f2f6a40b7186/29660e1c-dd44-491c-8053-f233b75e9ec0/dist/manager.js:1:227917) at [https://cdn.weweb.io/components/f9ef41c3-1c53-4857-855b-f2f6a40b7186/29660e1c-dd44-491c-8053-f233b75e9ec0/dist/manager.js:1:228379](https://cdn.weweb.io/components/f9ef41c3-1c53-4857-855b-f2f6a40b7186/29660e1c-dd44-491c-8053-f233b75e9ec0/dist/manager.js:1:228379) at Array.map () at yt ([https://cdn.weweb.io/components/f9ef41c3-1c53-4857-855b-f2f6a40b7186/29660e1c-dd44-491c-8053-f233b75e9ec0/dist/manager.js:1:227537](https://cdn.weweb.io/components/f9ef41c3-1c53-4857-855b-f2f6a40b7186/29660e1c-dd44-491c-8053-f233b75e9ec0/dist/manager.js:1:227537)) at [https://cdn.weweb.io/components/f9ef41c3-1c53-4857-855b-f2f6a40b7186/29660e1c-dd44-491c-8053-f233b75e9ec0/dist/manager.js:1:227552](https://cdn.weweb.io/components/f9ef41c3-1c53-4857-855b-f2f6a40b7186/29660e1c-dd44-491c-8053-f233b75e9ec0/dist/manager.js:1:227552) at Array.map () at yt ([https://cdn.weweb.io/components/f9ef41c3-1c53-4857-855b-f2f6a40b7186/29660e1c-dd44-491c-8053-f233b75e9ec0/dist/manager.js:1:227537](https://cdn.weweb.io/components/f9ef41c3-1c53-4857-855b-f2f6a40b7186/29660e1c-dd44-491c-8053-f233b75e9ec0/dist/manager.js:1:227537)) at Object.\_fetchCollection ([https://cdn.weweb.io/components/f9ef41c3-1c53-4857-855b-f2f6a40b7186/29660e1c-dd44-491c-8053-f233b75e9ec0/dist/manager.js:1:229241](https://cdn.weweb.io/components/f9ef41c3-1c53-4857-855b-f2f6a40b7186/29660e1c-dd44-491c-8053-f233b75e9ec0/dist/manager.js:1:229241)) at Object.\_fetchCollection ([https://editor-cdn.weweb.io/public/js/index.eab04a57.js:1:438493](https://editor-cdn.weweb.io/public/js/index.eab04a57.js:1:438493))”

## message: “e.replaceAll is not a function”

Any insights into what is going on and how to resolve it would be greatly appreciated!

 ![Screenshot 2024-10-31 at 6.20.27 AM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/b4c53189f9f4bd3959400ce68fd08438d7fbf459.png)  
 ![Screenshot 2024-10-31 at 6.20.07 AM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/0/0ed0d7dc068d2e896279bd6ab7d51a40f42b1b44.png)

---

<div class="post-metadata">

**Author:** ![savannah](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@savannah](https://community.weweb.io/u/savannah)\
**Post date:** [October 31, 2024, 1:49pm UTC](https://community.weweb.io/t/filtering-bug-with-multiselect-dropdown/14276/2 "2024-10-31T13:49:20Z")

</div>

I’ve narrowed down the problem to the fact that I’m trying to search an array (grade\_levels) for values in another array, the currentSelection variable in my multiselect dropdown. Any ideas on how to do that?

---

<div class="post-metadata">

**Author:** ![savannah](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@savannah](https://community.weweb.io/u/savannah)\
**Post date:** [October 31, 2024, 2:50pm UTC](https://community.weweb.io/t/filtering-bug-with-multiselect-dropdown/14276/3 "2024-10-31T14:50:07Z")

</div>

Not sure if it was a bug or if there was an easier way to do this, but I did find a work around that worked for me. Sharing in case it helps others.

I created a new table in Supabase with variables school\_number and grade\_levels that has a unique row for each grade level in each school.

Then, I used the lookupArray and rollup formulas to filter my table (using Supabase backend filters in WeWeb because the data set is large). Basically, it says—check this new table (called schools\_gradelevels) and see if any of the values of grade\_levels match any of the values in my multi-select current selection array. If it does, it returns the school\_number. Then, the filter asks if school\_number is in this new array that I have created using the formulas. Clear as mud? 😉 Maybe the pics will help.

 ![Screenshot 2024-10-31 at 10.45.38 AM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/1/16c61cb06cd667a15e8357c8a3c9fa89659c70c3.png)  
 ![Screenshot 2024-10-31 at 10.47.04 AM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/bc2664f536020ce94ccb8b0257ad391d88597c17.png)

---

<div class="post-metadata">

**Author:** ![savannah](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@savannah](https://community.weweb.io/u/savannah)\
**Post date:** [October 31, 2024, 4:17pm UTC](https://community.weweb.io/t/filtering-bug-with-multiselect-dropdown/14276/4 "2024-10-31T16:17:02Z")

</div>

Not resolved, it seems! This formula isn’t searching through all 19K rows of data in supabase, even though I’m applying the filter on the backend. Still open to ideas!

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [October 31, 2024, 4:51pm UTC](https://community.weweb.io/t/filtering-bug-with-multiselect-dropdown/14276/5 "2024-10-31T16:51:54Z")

</div>

You might wanna try filtering with the new Supabase Workflow Actions instead of the Collections. Check this out:

> **[Become a Supabase Magician in WeWeb (Tutorial With Examples) – Broberto](https://broberto.sk/radar/weweb/become-a-supabase-magician-in-weweb-with-examples/)**
>
> Discover advanced techniques for using Supabase with WeWeb. Enhance your apps with these advanced examples and interactive WeWeb examples.

---

<div class="post-metadata">

**Author:** ![metalsteve81](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@metalsteve81](https://community.weweb.io/u/metalsteve81)\
**Post date:** [October 31, 2024, 5:55pm UTC](https://community.weweb.io/t/filtering-bug-with-multiselect-dropdown/14276/6 "2024-10-31T17:55:29Z")

</div>

This might be the same issue I had. I dont really understand the reasoning but what I had was similar to you and wouldnt work.

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/b31ffc087f5784e35eb1a4954658ba30ff011e66.png)  
this image shows the working version.

originally The “title” was just a text column because its just a text value. The operator was “is in” and the bound formula was the array. To me that should work. but it didnt work until I changed the “title” to be an array with a single value, the operator to be “has any of” (also works for “has all of”) and then the same bound array.

you could try that,  
one caveat was that when its in a group with another filter the “ignore if empty” toggle didnt work. I had to set a variable to the on/off of the “apply if”
