Filtering a repeating group using attributes of the children

Hello everyone,

I started working on Bubble a couple of weeks ago, and I’m on my way to building my very first app - very impressed by the possibilities so far.
A few days ago, I ran into my very first roadblock, though. There’s something that I try to do that doesnt seem to work using the basic principles of the software, so I am seeking your help.

My application is a trail running event search engine. and my problem is with cross-table filtering.

To give you some context : my database is composed of three interconnected tables:

Races - This is the master table for the names of the races, like “Saintélyon” or “Maxi-Race”, with fields for ID, Name of the race, Region, Postal Code, and City.

Editions - These records represent specific instances of a race, for example “Saintélyon 2023”, “Saintélyon 2022”, “Maxi-Race 2022”, etc. with fields for ID, Race ID (the link to the parent “Race” table), Starting Date, and Ending Date, and an image with the poster of this specific edition.

Tracks - These are the different tracks associated with each edition - for exemple in the “Saintélyon 2023” event, there are several tracks : “Saintexpress” or “Saintésprint” for instance, with the following fields : ID, Edition ID (to link to the parent Editions table), Name of the track, Distance, Elevation Gain, and Elevation Loss, starting time, number of participants, etc.

In my homepage, users should be able to search for events by date, location, and track distance. Here is a sneak peek (sorry it’s in french) :

By clicking on the search CTA, users are redirecting to the following “results” page, where as you can see, I present them with a list of events (a repeating group of my “Editions” table) matching thier criteria. For each element of the list, there’s a nested repeating group displaying the list of children “tracks” , associated with the current element - displaying only two attributes (distance + elevation gain) :

While I didn’t have any trouble to set up the filters by dates and locations, I am struggling to filter this list based on the track distance - since that data do not belong to the “Editions” table, but to the “Tracks” table.

Could someone advise me on how to set up a search constraint that allows to filter “Editions” by the distance range of related “Tracks”?
I have thought of several things so far (like restructuring the database to reference the “Tracks” as a list in my “Editions” table) and browsed the forum multiple times, but without any success so far… :smiling_face_with_tear:

Any insights, comments, or hints to plugins that could facilitate this kind of relational data filtering would be invaluable.

Thank you so much for your assistance!

Some approaches:

  1. Advanced filter - search:filtered (Advanced) This Race’s Editions:filtered distance > X and < Y:count > 0

  2. Just store a list of race distances on the Race type (can literally be a list of numbers), and update it any time a race is created/edited/deleted. Backend triggers are helpful for that.

Thank you soooo so much !!!
It works perfectly fine ! :partying_face:
I added this new list column to my database and reuploaded the data again to populate it, and used this “filtered” option as you advized.

Awesome !
Thanks again