Do a search for Multidropdown Values

Hey there!
I got a Multidropdown where the User can pick different catgories (from an set up option set for categories). Now I have a repeating group which shows pictures which have a categories value that can contain 1 (minimum) to 3 (maximum) categories from the above mentioned option set.

Now I want to update the repeating group, whenever the user adds a category in the multidropdown so that it shows all pictures that have the category the user chose.

For example:
Multidropdown is empty —> All pictures are shown
User choses “Summer” and “Winter” value in the Multidropdown —> Only Pictures with either Summer or Winter in the category value are shown

Thanks in advance for your help!

Hi @c.wittelsberger,

To update the repeating group based on the selected categories in the multidropdown, you can use the “On change” event of the multidropdown to trigger a workflow that filters the repeating group to only show pictures that have the selected categories.

Here is an example of how you can set this up:

  1. First, create a multidropdown field in your data model and set up the options for the categories.
  2. Next, create a repeating group and set the data source to be the collection of pictures that you want to show.
  3. In the repeating group, create a filter that checks if the category field of each picture contains any of the selected categories in the multidropdown.
  4. Finally, create a workflow that is triggered by the “On change” event of the multidropdown and filters the repeating group using the filter you created in step 3.

This way, whenever the user selects a new category in the multidropdown, the repeating group will automatically update to show only the pictures that match the selected categories.

Hey @bubble.helpers
Thanks for your fast reply!
I understand everything you said, but somehow I cant manage to set the filter right for Step number 3.
Could you please show me how a filter would look with “Do a search” that checks if the picture category include one of the multidropdown values?
Shouldnt it look like that: “Pictures Categories contains Multidropdowns Categories value”
But this wont work because i think both of them are lists

Thanks in advance!

Sure, here is an example of how you can create a filter in a repeating group in Bubble to show only pictures that have a category matching any of the selected categories in a multidropdown:

  1. In your data model, create a field to store the selected categories in the multidropdown. This field can be a list of text values or a list of reference values, depending on how you have set up the options for the categories.
  2. In the repeating group, create a filter condition that checks if the category field of the picture contains any of the selected categories. Here is an example of how you can set up the filter condition:
  • Field: category (the field in the picture data type that stores the categories)
  • Operator: contains any of
  • Value: [selected categories field] (the field in your data model that stores the selected categories)
  1. Save the filter and test it by selecting different categories in the multidropdown. The repeating group should show only the pictures that match the selected categories.

I hope this helps! Let me know if you have any questions or need further assistance with creating a filter in a repeating group in Bubble.

If the images had only one category this could just be a single search of images where “category is in mutidropdown value” with “ignore empty contreints” checked. The filtering would happen in the backend and bubble would automatically request new data when the input of the dropdown changes (no workflow needed).

Because the category of an image is a list you need to filter the search client side and use a condition, but still no workflow is needed:

  • set the data source of the repeating group to a search for all the images. This will be the default data when nothing is selected in the multi-dropdown.
  • add a condition when the “multidropdown value count > 0” and set the data source to a search of all the images filtered by this advanced filter:

That’s it.
Just remember that the filtering it’s happening in the browser and may be slow for big lists.

Thank you very much for you help!
@dorilama you mentioned for big lists it might be slow. Is there a way I can do this searching not in the browser?

If you have only one category per image so you can just search like this:

Even if you do multiple searches (like one for each selected option) you still need to merge them client side and that will loop over all the lists anyway

Hi, I would do it like this:
In the search for the repeater group I would put “category= multidropdown value” and in the search “ignore empty constrain”
It must resolve.

This really helped @dorilama, Thanks

1 Like

I have this exact same situation as well but I have a search button which triggers the search. So your method works but it fires the search before the search button is clicked. Is there a way to do this in workflows?

instead of setting the data source in the element use an action to set it when the button is clicked

1 Like

Thank you sir. Simple when you say it.