Create a repeating group via the entities contains list

Hi everybody,

I have been banging my head against a brick wall all day with this one and I really cannot work it out.

OK, so I have 3 entities.

Trainers, Venues & Courses - Trainers run multiple courses from their venues.

The data structure is:

Trainers
All of the trainers details

Venues
All of the venues details
Trainer Link - This is a single lookup for the trainer

Courses
All of the course details
Venues - A list of venues where this course is available

So far so good!

On the trainers dashboard I want to show a repeating group that shows all of the courses that they run across all of their venues.

Repeating Group
Do a search for courses
Venue CONTAINS Do a search for Venues (trainer = Current page trainer)

But this doesn’t work.

The filter is looking for a single venue not a list of venues.

What I need and continually fail to do is filter all of the courses by the list of contained venues and if the course contains one of the trainers venues then it is included in the repeating group.

I’m pretty sure that there is a way of achieving this but the expression alludes me.

I’m hoping a bubble genius has the answer.

Thanks in advance.

If you share screen shots of your data sources, or even better read access to your editor, this should help to solve.

Hi @SerPounce, thanks for your reply.

I’ve created a quick demo of the problem that you have access and edit here: https://bubble.io/page?name=index&id=database-rg-problem

Thanks again :slight_smile:

Sorry @shaun, I’m a bit confused. The demo seems to be working as it filters for Trainer1. What is the outcome you’re looking for?

I want to show a list of courses where the courses list of venues contains the venues when the venues trainer is trainer 1

It’s not working and it shows an error and the RG shows no entries. https://share.getcloudapp.com/DOuQx1QR

Below in the other repeating groups you can see as follows:

  • All courses and the list of venues that they have
  • All venues and the trainers
  • A repeating group that shows the venues with a nested repeating group of the courses available at that venue

The expression that I need is:

Do a search for courses
“Courses” “List of Venues” “CONTAINS” (Do a search for venues (Trainer = Trainer 1:First Item))

This should bring back a list of venues and if one or more of those venues are in the courses venue list then the course should be included in the list.

The problem is that the above only seems to work with a single venue being returned.

Does that maybe make a little more sense?

Cheers

Shaun

The Repeating group should be showing:

Course 1 - Venues 1 & 2’s trainer = Trainer 1
Course 2 - Venues 1, 2 & 3’s trainer = Trainer 1
Course 3 - Venues 3’s trainer = Trainer 1
Course 5 - Venues 1’s = Trainer 1

I’ve tried millions of ways but can’t get it to show any.

I gave it a crack, but couldn’t get there. See if you can take what I’ve done with the advanced filter which now doesn’t have any errors to get it over the finish line. Sorry, gotta shut down for the night.

Thanks for trying… I have gone down that road myself but got nowhere.

Maybe it’s not possible! :frowning:

Ok, I think I got it. Check out my attempt now. The problem from last night was embarrassingly that I had Trainer 1 entered as Trainer1. :blush:

I believe it also working in the third “Anyone can edit” RG using a custom state on page load.

Thanks for trying but that still doesn’t work.

It was pulling through the first venue on the course entity and not running against all venues available.

I have changed the order of the venues and as you can see Course 1 now is no longer showing despite the fact that there are 3 venues by trainer 1 that run that course from.

I really appreciate the effort.

Eish!!
Now I am stumped. I used this as a reference for M:M filtering using intersect:

I don’t understand why the updated filter brings back all the courses. This logic should work as index’s whichVenues only includes those for Trainer 1:
Screen Shot 2020-04-26 at 6.49.41 AM

Index’s whichVenues displayed here:
Screen Shot 2020-04-26 at 6.51.00 AM

Sorry @shaun. Gotta get back to my app now.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.