I’m looking to create an app where I have three elements:
a device (ex: computer screen)
brand (ex: LG)
device model (ex: 34WL500-B)
I wonder if I should create only one data type (Product) which contains the device, brand, device model (all three are a predefined list)
I’d like to create a multi step form where users choose first a device type, then a brand (the brands displayed will be only the one associated with the device type), and then the device model (with the same condition)
Or is it better to separate into three different objects and create relationship between them? If so, how, in my form, can I say: “If the user chose Computer Screen, show only the brands associated with Computer screens”?
Sorry if this seems pretty basic, I’m not yet quite acquainted with optimising the data structure
I’d create the product data type, but have those three filters as option sets (option set for device, option set for brand, option set for device model).
You can check out our tutorial for “Advanced Filters” on nocodify.com to get a good in-depth tutorial on how to implement this.
Good database design principles (data normalization) calls for splitting your datatypes. I’m counting three that you’d need… model, brand, and type.
Model should be a datatype (and to me is your central datatype). For others, you could set them up as option sets or datatypes. For that decision, it really depends on how you plan to set things up. Option sets are easy to work with and Bubble says they are faster. But option set data cannot be made private, new options cannot be created within the app (only in the admin panel, and you need to deploy a new version of the app for them to show up), they can’t be imported/exported, and the searchbox won’t work on them. If I were to do this I’d probably setup the brands as datatypes and the type as an option set – but I have no idea what you’re planning to do with the information, and the usage should guide your structure. Read the documentation and forum posts on option sets which should guide your decision.
In terms of a multi-step form, you can accomplish that either via how you set up your searches, or you could manually set them. Setting that up via searches will be easier to maintain because it will be dynamic, but if your dataset gets to be huge it can slow down (and then you get into questions on which way to link data, which is a whole other topic you’ll find discussed in posts on speed). For examples on how to present specific sets of choices based on a user selection, look for forum posts where a user selects a country and then is presented with a list of cities. Your other approach could be to set up those menus manually (in your device dataset or option set, have a list field where you connect the brands that contain such a device). That would run faster for the user, but could become a very problematic to maintain if you have thousands of items and multiple people submitting them.
Best thing is to set up some simple sample data and start playing around with the various approaches to learn the various methods of doing things.
Thank you both for your answer and especially Ed for making it very complete.
I’m gonna try both options to see which one is fitting the better, but based on what you say I think option sets will no be a good idea — because I need users to add new options to it.