Filtering bug with multiselect dropdown?

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) at 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 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) at 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) at Object._fetchCollection (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)”

message: “e.replaceAll is not a function”

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


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?

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? :wink: Maybe the pics will help.


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!

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

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
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”