Filtering Array on Front End for Contains

I am trying to develop a custom multi select with search from the ground up—the WeWeb element is a bit too rigid for my liking. Anyhoo, I have a collection, eg Insights Page Filters, that returns a handful of arrays, each with its own set of values, eg outcomes, that you can filter by. I am binding this to a list of items which appear in a dropdown. At the top of the dropdown is a search box. I am trying to “filter” the array of outcomes for items which “contain” whatever value is in the search box. This should feel no differently than searching WeWeb variables, collections and functions.

The problem I am having is, instead of being able to create a filter such as “where [array of outcomes] contains [search query]” I am being forced to filter on an individual index—eg 0, 1, 2, 3, etc— within the array. What am I doing wrong here?

Mine’s not front-end, but it does the job for you pretty much :slight_smile:
https://marketplace.weweb.io/libraries/df32b91d-b9da-42b3-9e59-47f78fbc2579/

As per your question, it’s really weird. Are you sure it’s the outcomes is an array? It seems like the filter recognizes it as an object.

Sweet! I’ll look into your component on the Marketplace.

To respond to the question, glad to hear someone else thinks this is behaving weird and has me wondering if this is a bug. I believe my parent is an object, but I am binding an array to the items. I’m also wondering if I need to change the way I’m structuring my data within the collection.

It indeed seems like you have an array of objects with an {index:value} format