Forum Academy Marketplace Showcase Pricing Features

How to display a list of items in repeating group containing atleast one of the selected "tags" or "keywords"

Hello All,

I need help figuring out how to display/filter a repeating group to show ALL items containing at least one of the selected tags.

Current set-up:
Data Field: Items For Sale
Problem Field: Item For Sale’s “List of Keywords” which is a List of Keywords (not text)
Repeating Group: Data = Do a Search for Items for Sale
Filter1= Contains Dropdown Item for Sales Category
Filter2= Contains Dropdown Item for Sales Owners Name
Filter3(this is what I can’t figure out how to accomplish)= contains at least one of multidropdown selected “tags” option

Basically I’d like to have a data field of “keywords” a seller assigns to their item for sale (up to 10 tags/keywords) and then I want to be able to display all items containing at least one of the selected keywords. Right now, I can only get the repeating group to show Items for Sale that have “All” of the selected “keywords” only. For example, if an item has both the keyword “Wall Art” and “Acrylic” and another item has only the keyword “Acrylic”, when keywords Wall Art and Acrylic are selected, only the first item is appearing because it has both “keywords”

Any advice? I know there are different ways to filter repeating groups but hopefully there is a way to make this work. The multi-dropdown is so clean I hope to be able to make it work but am open to all options.

I have the same problem. Struggling to find a solution at the moment. Fairly confident there is a way to do it. Currently looking for solutions myself

You need to use an advanced filter and :intersect with. Search the forum for “intersect with” and you’ll find posts with instructions on how to do it. Like this one…

1 Like

Appreciate the tip. Thank you! Intersect was part of my solution! your link led me to this response which was very illuminating Advanced filter - multi constraints context - #3 by romanmg

Additionally this youtube video also expanded my understanding. In the end I accomplished exactly what I want…in what I believe to be a straightforward approach (not overly complicated) https://youtu.be/gBET3ZKdYR0

My context was that I had a Repeating Group of “Coaches” that listed “Coach Skill Expertise” in every RG cell. Any coach could list 1,2,3 etc “Skills Expertise” topics they offer. I wanted Users to be able to see 100% of the coaches on page load (ie a full Repeating Group with a basic search of Coaches no constraints). However there was a separate dropdown where Users could select one or more “Skills” they want the RG filtered by to see which Coaches had the chosen Skill they were looking for.

To accomplish this my Step 1: was to set a custom state of “Chosen Skills” coded as a ‘List’ state (ie multiple checked skills) Step 2: I set the default Data source of the Repeating Group as Search for data type “Coach”. This was done to have the RG load all “Coaches” on page load. Step 3: Inside the RG Conditional tab I opted to have the “data source” of the RG switch to a ‘filtered’ search only if the custom state of the list of “Skills” had at least one item in it (ie at least one was checked). Step 4 I chose “Filter” with “Advanced” and matched up ‘overlapping’ entries using the “intersect” feature comparing the original RG’s coach listings vs the custom states list of Skills. And it worked. Now users can browse & navigate the option of Coach Skills very easily & the RG updates rapidly with no identifiable lag.

Glad you got it working. Couple further tips…

Using a conditional to change the data source isn’t required. You can put the advanced filter on the RG main data source. If you’re using a multidropdown, just have the expression start with… Multidropdown value count is 0 or… That will check if anything is in the multidropdown, and if not it will ignore the filter. By having it in the main data source, you have the flexibility to add other search constraints over time to it.

I did a quick skim of that video. For future reference… couple of things I would do in a different way. First is it is showing the use of a :filter with a one-to-many search (vs. the many-to-many search you are doing). With a one-to-many search, you can put the constraint directly in the “do a search for” which ensures it will execute server side and be more scalable. Second, with the list of checkboxes, you can set those options up in an option set, which helps since you can add new options and change names and everything flows through. Then display the checkboxes as a repeating group and you only have to write one set of workflows, and new options will be added automatically if you add them.

PS: if you expect to have a lot of coaches over time in your database, make sure you are using a scrolling RG or pagination – otherwise it will download all the coach data whenever you open the page.

1 Like

Conceptually I understand what you say but I can’t get it to work. Issue is the RG doesn’t load anything on page load when I put Advanced filtering in main RG main data source. Only until a checkbox has been selected does the RG populate properly with the correct intersections etc. I’m not using a multiselect dropdown. Instead I’m having a Group Offset of ‘Coach skills’ appear when user presses a Button. May not be important but the group offset off available skills contains a Repeating Group of “Coach skills”; and in my database those skills are an Option Set. Anyway as the user selects 1 or more skills those “skills” are saved in a Custom state ‘list’. And that custom state list of “Coach skills” is what feeds into my ‘Advanced’ filtering approach. In a single question I don’t understand what the Advanced filter expression should be in the main data source? When you write “Multidropdown value count is 0 or…” What comes after “or”? I tried many variations but nothing presents all the coaches on page load before any “skills” have been checked by a user.

On your last 2 points (ie last 2 paragraphs) I 100% agree. That video had several shortcomings but it helped my envision the use of Advanced filtering better. Which up until now I have barely used. I actually am already using Options Sets for my checkbox lists for the exact reason you mention. And always useful to think about load time when presenting RGs. Thank you for reminders on both; good practices must always be front of mind.

Just put that count expression at the beginning of your intersect with expression. So it would be something like the below (I’ve added [brackets] around stuff where you’ll have specific names, but clearly don’t use brackets in the expression):

[custom state list of selected skills]:count is 0 or [custom state list of selected skills] intersect with [this Coach’s Skills]: count >0

You’re correct that the filter as you have it will only show results if a skill is selected. But if you put this “or” expression as part of it, it will let through results when there is no skill selected, since the expression basically says to only apply it when the user has selected skills.

1 Like

#1 you’re right. huge thanks & gratitude :slight_smile: and #2 HOLY SMOKES I realized I did 99% of that EXCEPT that inside my filter, my ‘set state list’ count was expressed “>0”; not as you clarified must beis 0”. That makes all the difference. All this time I must have been ignoring this kind of approach in other places in my app…I’ll obviously need to go back & check. Because this ‘IF THEN’ expression makes sense to me as it’s common in MS Excel but up until now it’s been tricky to express inside Bubble.

THANK YOU ONCE AGAIN FOR YOUR CLARITY OF EXPLANATION & PATIENT GUIDANCE ALONG THE WAY.

One minor follow up. How do you think about deciding to select or not select the “ignore empty constraints” checkbox when ‘filtering’ a search list?
I generally think I use that option correctly elsewhere in my “do a search” expressions but curious what general principles you may offer on the matter.

You’re very welcome!

Re: how to use “ignore empty constraints”, I believe it only applies to stuff in the “Search for X” box, not the stuff in any “:filter”

I use it because in my app, users can search for things based on a bunch of inputs (text, dropdowns, checkboxes, etc.) and I want empty inputs to be ignored, since users won’t always put something in each input.

Generally regarding “:filter” – I try to avoid it as much as possible and have everything in the Do a search for box. My only exception currently is I use an advanced filter and :intersect with with for a many-to-many search. Intersect with works fine with smaller data sets, but when you start to get larger, it bogs down since all the data must first be loaded to the user’s browser (ie the search is done client side).

On the forum at least, there isn’t any established method discussed for doing many-to-many searches server side. I’m currently exploring using an intersecting table to do the search server side, and will post my results when done.

2 Likes

Extremely helpful :pray: All good points to consider as my app develops.

1 Like