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