Help needed with nested repeating groups please

I’m new to Bubble and strugging with nested RGs.

I have two tables “Category” and “Service” - the records in “Service” have a field of type Category called “parent_category”.

I have a test page with nested RGs.

The first has Type of Content = Category and Date Source = Search for Categorys and this shows all records from the Category table.

Within this is a nested RG with the Type of Content = Service and Data Source = Search for Services with a constraint “parent_category = Current cell’s Category”.

This is the output which is as expected:

My question is:

How can I stop the cell containing “Category: Pest, Plant and Lawn Health Management” section from being displayed? This category has no related service records and I do not want it to be displayed.

I understand the correct way to do this is to prevent this Category from being returned by the query used by the first RG but I do not know how to only deliver the Catagorys which have one or more related Service records.

This is driving me mad. Any help would be much appreciated. Thanks.

Personally, I wouldn’t have multiple searches within your RG.

Your WU = :rocket: :rocket:

It can be achieved with a single search and it can solve your problem.

Instead, save a search for ALL the services you want to display in a state on your page.

In your Category RG, use that state containing services and GROUP BY the Category. You now have a distinct list of categories where there’s a service.

Next, within the Category RG, create another RG with the data source set to the Service state and filter based on the parent category.

You get what you want and your WUs are conserved.

2 Likes

Thank you so much.

That worked brilliantly and I would never have worked this out without your help.

I’ve been stuck on this for about 3 hours!

1 Like

İf those are static, make them option set

1 Like

They are not - but thanks anyway as I can see why this would be a good idea if they were.

I don’t get it just add a list under category, call it services, why you need to add parent_category = current cells category ?