Alternative to Looper Plug-in for Gathering Relevant Records

Learning the ropes on bubble. I’m a little stumped on this scenario.

I have these data types:

  • user
  • Car
    • car company
    • car class
    • color etc…
  • Car Company
  • Car Class
  • Preferred car types
    - Car company
    - Car Class
    -linked on user object as list

So a user might have 3 entries in their “Preferred Car Types” field such as
1.
Subaru
Hatchbacks
2.
Nissan
Sedan’s
3.
Ford
Pick-up trucks

I want to gather all cars that match any of their 3 preferred car types? And there could be any number of “Preferred car types” on a user’s profile. I am familiar with merging lists and using the “Looper” plugin, but is there a more efficient way of doing this in bubble?
Thanks in advanced for any help.

Maybe this?

Search for Car, constraint Car Class is in Search for Preferred Car Types, constraint User = Current User, then after this nested search do:each item's Car Class

Thanks for the reply. I don’t think I made my question all the way clear.

Where would i go from here to only grab the cars that also match the preferred company as well?

add another constraint car company is in testing_nest_loop's z - user's preferred car type:each item's car company :slightly_smiling_face:

Wouldn’t that include all Subaru trucks and sedans?

I’m trying to only return cars that match both fields for an entry

It would return Cars where it’s Car Class has to be found in any one of the user’s preferred types, and the Car Company also has to be found in any one of the user’s preferred types.

So if the user has 3 entries like you said:
1.
Subaru
Hatchbacks
2.
Nissan
Sedan’s
3.
Ford
Pick-up trucks

It would find Subaru Sedans, or Nissan Pick-up trucks, or Ford Hatchbacks

right. Do you know how i would do this so i could only find cars that are

subaru and hatchback
OR
nissan and sedan
OR
ford and pick-up trucks

maybe i’m just not structuring the data types in the best way to achieve this.

:thinking: ​​​​​​

I am tempted to suggest to you to make a “Company Class” containing fields for Car Company and Car Class

Then add a “Company Class” field on the Car, and add it on “Preferred type” as well, and remove the Car Company and Car Class fields.

So you can just search for Cars where the “Company Class” is in the user’s preferred Company Classes…

If you are willing to change data structure AND you need to maintain those Company Classes, so when you pick a new Class for a car, you need to lookup if a Company Class exists for that car’s Company and Class, if not make it, if yes, then use the existing one…

Maybe another way using advanced filter… won’t be fast database though…

i think you’re right with that database structure. Thank you for walking through this with me.

I’m not familiar with advanced filtering. I just looked it up. Is this especially slow?

Yea I don’t recommend it cause it gets slower the more items it has to filter, try my first suggestion where you categorize by “Company Class” :slightly_smiling_face:

Got it. and I’m seeing many other forum posts about optimizing speed by filtering out records before using advanced filters. Appreciate the help. Have a good day :slight_smile:

1 Like

Yea I use it all the time, but its on the assumption I am only filtering small list of things, or some list (of any size, big or small) but on the assumption its already data all loaded on the page already.

For this it’s like it needs to search your whole Car database w/ advanced filter checking the pairs of Company + Class somehow, but I haven’t figured out the expression that would do that anyways still… :rofl: :+1: