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.
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.
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.
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.
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: