Help with a complicated (to me) search

I have 4 tables that store details about users and events they attended along with evaluations. A trainer might have a couple thousand attendees and I can’t figure out how to do a search so they can search by ‘any field’ on the user table (typically name or email) and restrict it to only the events they are the trainer for.

Table:
Event Attendees

  • user (link to user)
  • event ( link to event)
  • evaluation (link to their evaluation)

User

  • user meta data (many fields)
  • events attended (list of events attendees)

I can easily get the list of event attendees for that trainer and show that full list. I currently have a dropdown to filter that by the event, whether there is an evaluation or not etc, but can’t figure out how to let them search for users.

I’m trying to do this:

  • search for users where anyfield contains the search value entered by the user
  • and where the user.events-attended list contains (search for events hosted by the trainer)

Surely the Events Attended contains constraint should just be a search for events where the Trainer is the Current User?..

yes, it’s filtering based on the events that belong to that trainer, but I don’t know what to select after that filter operation.

The Search for Event Attendees constraint is 'where events attended is in

Ah… it’s a list field… you can’t compare two lists in Bubble in a search.

With your current database structure there’s no simple, or performant/scalable way to do this in Bubble… you’ll have to use an Advanced filter (which is done client-side, and therefore is not scalable).

But in any case, it shouldn’t be a search for Event Attendees, it should be a search for Events.

A better, more performant, and scalable (and more Bubble) way you could do this, would be to add a list of Users field to the User datatype to store the trainers of attended events.

Then you can simply search for Users who’s Attended Events Trainer field contains the current User.

cool, I may give that a whirl. I did try the reverse. I search the events attended where the user is in <search for users where any field contains user’s search input> AND where the event is in the list of events hosted by the current user.

that seems to work. My whole data schema needs an overhaul, it’s largely built based on migrating off another event hosting platform.

Plus it’s annoying that users can’t sort the data by users alphabetically…unless list shifter allows for stuff like that.

1 Like

Algolia? But I have a feeling the data not 100% public.

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