I want to create a database called “Categories” and another called “Subcategories”
The categories should have two fields: Categories (text) and Subcategories (list of texts/Subcategories)
For instance, one row would be (with column titles):
Category | Subcategories
Health | Hospitals;Primary Care;Clinics
where each of the entires in the Subcategory cell of the first row are separate entries of a list
The Subcategories table would contain one variable: Subcategory (text), where the first row would be something like (with column title)
How do I create a database like that?
To achieve exactly what you asked, you’d almost do what you spelled out:
(Just create the children first)
-Create new type: Subcategory
(Which sounds like it’d just be “Name” right now)
-Create new type: Category
Subcategories (Which would be of type “Subcategory” and the little box would be checked for “this is a list of things”)
Reality-wise however, only do this model if the amount of subcategories per category will be less than 100 or so forever. Otherwise, you’re going to want to define a bridge/XREF table for better scaling.
I wasn’t clear in my question, sorry! I understand that is the structure I want to build out, but how do I populate those fields? This is data would be built into the app from the beginning; a user couldn’t change any of those three data type, but be able to select from them, if that makes sense. In other words, once this data was uploaded by me, it won’t be changed again.
Yeah, you want a definition/REF set loaded.
Two ways to do this:
- Option sets. Instantiate your subcategories and then categories as option sets. Pro: intuitive to setup. Con: horrible to maintain autonomously.
- Pre-seed the tables. You can do this via a CSV import into the defined tables or just create a throw-away backend page where you can enter them manually. Then trash the page when all done.
EDIT: the CSV route is difficult to assign “lists of things” such as your subcategory. On second though, better just either do the Option Sets or the manual seed via backend page route.
A third option is to just use the Bubble editor straight to create your “New Entries” into the tables. It comes complete with lookups to create the Subcategory reference within your Category table, but it’s cumbersome enough to only be warranted for maybe a few dozen entries tops.
Thanks! It looks like option sets might be the solution, I’ll play around and see if it works
Hi, im working that has a really similar structure but I dont know how change specific items of a subcategory.
I have a fixed product lists, each product have certain variables that are also lists. (for example each product has colours wich area list of texts (red, blue green) and size that are a list of numbers (1,2,3,4).
Every user can build a personalized product basket that has a list of the products that he wants. But im not able to define individual characteristics to each one. For example a shirt is red in size 2. Every time I change the user basket, it changes the original product.
Sounds like you’re making updates to the original Option Sets? Your user cart needs to be a separate table (or on-page/in-session custom state for the user) of TYPE of the Option Set. Not sure if I’m going down the right path here, so provide screens of your workflow of the user basket change action as well as your data structure/Option Set.
This worked!! Thank you very much.
Hi There Jesse
Please can you help, I am going crazy here
So like Fiverr, you have products people will list, and then a user can select a category and sub categories for their product listing. Category will be one and a user can select multiple sub categories to list their product. So product “create an email campaign” category “digital marketing” and sub categories “emIl marketing “ and “drip campaigns” and “content writing”
What I have done . I first created an option set fir the categories and linked attributes to each option fir the sub categories. I ran I. To a few problems and canned that idea, probably did something wrong.
I now have a data type called products and have category fields as text and sub category field as list of texts. I have a static accordion that drops down the 4 categories which are each in its individual group, and I created a set star fir each so I can show the categories in my repeating group. How ever, I cannot get sub categories to show in the repeating group. I think my data structure may be wrong. Please can you help. I think because the state I set fir the sub categories is a list maybe. Not sure