Hello everyone, I am new to Bubble and I need your help please.
I want to filter a repeating group according to a multidropdown element.
The multidropdown allows to select options (“Exposition” in my case) configured in option sets. The multidropdown configuration seems ok, I can select the Exposition options when I am in Preview mode.
I want the repeating group to match the Multidropdown A’s value. However I think I need to add something in the data source field after “Exposition contains Multidropdown A’s value”
because the system does not accept it. I cannot figure out which field, function or formula I should use.
Hi there, @mossoc99… you will need to use an advanced filter to do what you described. First, remove the constraint in your second screenshot. Next, add the :filtered operator after Search for Plantes in your repeating group’s data source. Then, add a constraint to the filter, scroll to the bottom of the dropdown, and select Advanced. Finally, build an expression that should be something like This Plantes Exposition contains list Multidropdown A's value.
Also, if you have never used an advanced filter before, be aware that the filtering takes place on the client (browser) side. So, the search is going to return all of the relevant items to the client, and then the filter will be applied. Just something to keep in mind from a performance perspective.
Hi @mikeloc, thank you very much for your quick answer. It is working!
This opens a new door: this expression you suggested allows to filter the repeating group with Plantes that have the exact same value than the Multidropdown A input. It is an “AND” expression:
If Multidropdown A’s value = Option 1, Option 2
the repeating group displays data types that contains at least Option 1 AND Option 2
My first question is: what would be the expression to allow this case below :
If Multidropdown A’s value = Option 1, Option 2
the repeating group displays data types that contains Option 1 OR Option 2
My second question is : how can I let the user choosing between AND or OR filter for (a) specific field(s). Ideally I would like to have something similar to the Filter functionality in Airtable :
I think this second question is way more technical than the first one but if you have any suggestion, recommandation or ideas I should go into in depth it would be very helpful
Thank you for the information. Would you recommend another approach to answer the same need that is better from a performance perspective?
To have the repeating group display items that have any of the selected options, use this expression for the advanced filter: This Plantes Exposition intersect with Multidropdown A's value:count > 0
To let the user choose between AND and OR, give them a way to make that choice and set a custom state to a particular value based on the choice they make. Then, conditionally change the repeating group’s data source based on the value of the custom state.
There are entire books written on Bubble performance, so get to readin’ on that topic.
Wow, I can’t believe I just ran into the same problem @mossoc99 described, and we’re just the next day! Thank you so much @mikeloc for your answer, you also solved my problem!