I have two types of things: company and contacts. On the front end, I want to group the contacts with a company. Not sure if I should create two data types (company and contacts) or if there is a way to make a table that is part of a data type. Trying to figure out how to 1) design a database and 2) display it on the front end
Hi there, @netveano… yes, you should have two data types, one for companies and one for contacts, Then, you can have a company
field (linked to the Company
data type) on the Contact
data type that associates each contact with a company, you can have a contacts
field (linked to the Contact
data type) on the Company
data type that stores a list of contacts for each company, or you can have both. With that structure in place, you will have no problem showing the contacts for a given company on the front end.
Hope this helps.
Best…
Mike
Hey Mike, Thank you for the fast response and recommendation. Is the linking based on a unique ID (company A) and do I need to provide that ID or does it Bubble provide some sort of drop-down that lets me select to link? I will start exploring how to do this right now based on the info you provided- cheers.
You will just be associating an actual thing in a data type with a thing in another data type, and Bubble takes care of the rest. How are you going to make the association? Through a user interface on one of your pages? Or in the database on the App data tab in the editor? If it’s the latter, you will want to click the Primary fields button on the App data tab and change the primary field of the Company
data type to something other than the unique id so you can type something like the name of the company when you are making the association in the database.