Relationships

Learn more about how relationship lets you link one record to another

A relationship lets you link one record to another (or many others). The examples above showed how you can relate Projects to Companies, and Projects to Owners, but there are 4 different types of relationships all together.

One to One

This is when each side of the relationship can only be directly related to at most one other record. For example, if each Company needed to be assigned an admin, you could say that each Company can have exactly one admin, but an admin can only be the admin of at most one company. That way you can easily access the company's admin's details.

Many to One

This is the most common relationship. The relationships used in our examples were examples of many to one relationships. That is to say, A given many projects can have the same company, but a project can only have one company. If you are using this data in the builder, the company will have a list of projects associated with it, but the project will have only one company associated with it.

One to Many

This behaves the same as many to one but in reverse. It's handy if you can't figure out exactly which side of the relationship to put the field on. Although it's always preferable to use a Many to One. For example, instead of adding the Many to one relationship on the Project table, you could instead add a One to Many relationship on the Company table, the end result would be the same.

Many to Many

This is the most complex of all the relationships, but it is very useful if you need to have multiple options on both sides of the relationship. If we take our Project owner relationship, but instead of a project only having one owner, if we change it to allow it to have multiple owners, then we would need a many to many relationship. Each project can have many owners, and an owner (user) can be the owner to many projects. When using this data in your portal, each side of the relationship will have a list of the opposite type. I.e. users will have a list of owned projects and projects will have a list of owners.

Last updated