mirror of https://github.com/nocodb/nocodb
Raju Udava
2 years ago
1 changed files with 91 additions and 0 deletions
@ -0,0 +1,91 @@
|
||||
--- |
||||
title: "Links" |
||||
description: "Understanding Link Columns!" |
||||
position: 540 |
||||
category: "Product" |
||||
menuTitle: "Links" |
||||
--- |
||||
|
||||
### Relationship types: |
||||
|
||||
- One to one |
||||
- A Table record in first table is related to only one record of second table. |
||||
- Example: Country has a capital city |
||||
- One to many |
||||
- A Table record in first table is related to more than one record of second table. But second table record maps to only one entry of first table |
||||
- NocoDB refers to this category of relationship as **has many** |
||||
- For every **has many** relation defined, NocoDB augments **belongs to** relationship column in the other table automatically |
||||
- Example: Country **has many** Cities. (other way mapping > City **belongs to** Country ) |
||||
- Many to many |
||||
- A Table record in first table is related to more than one record of second table; second table record can also map to more than on record of first table. |
||||
- NocoDB refers to this category of relationship as **many to many** |
||||
- For every **many to many** relation defined between tables, NocoDB augments **many to many** relationship column in the other table automatically |
||||
- Example: Film **has many** Actors. Actor **has many** Films (works on many films) |
||||
|
||||
Further details of relationship types can be found [here](https://afteracademy.com/blog/what-are-the-different-types-of-relationships-in-dbms) |
||||
|
||||
From Release v0.110.0, table records can be connected through relationships using the **Links** column type. |
||||
It is important to note that, earlier supported column type **LinkToAnotherRecord** for creating relations is considered deprecated. While the old datatype is still supported for backward compatibility, it is no longer possible to create new fields of that type. |
||||
|
||||
The main distinction between these two column types lies in how the contents are displayed within the cell when links are established between two tables. With the **LinkToAnotherRecord** column type, the cell displays the **Primary value** of the related records. On the other hand, the **Links** column type only shows the **count** of related records. |
||||
The decision to switch over to new column type was made to ensure better performance and scalability of the application, more so when the records & the number of records in the related table is large. |
||||
|
||||
Child list to display the related records can be accessed by clicking on the link count displayed on the cell. |
||||
Except for the column type, the following procedures remain same as before |
||||
- create, update & delete a relationship column, |
||||
- link & unlink a record, |
||||
- create a lookup and rollup columns |
||||
|
||||
Workflow details are captured below. |
||||
|
||||
## Adding a relationship |
||||
|
||||
<img width="1016" alt="image" src="https://user-images.githubusercontent.com/35857179/189105583-20014dd9-e5a6-4f27-b03c-97fad9096b5f.png"> |
||||
|
||||
### 1. Create column |
||||
|
||||
Click on '+' button at end of column headers |
||||
|
||||
### 2. Update column name |
||||
|
||||
Input name in the text box provided |
||||
|
||||
### 3. Select column type |
||||
|
||||
Select Column type as "Links" from the drop-down menu |
||||
|
||||
### 4. Choose relationship type |
||||
|
||||
- 'Has Many' corresponds to the 'One-to-many' relationships |
||||
- 'Many To Many' corresponds to the 'Many-to-many' relationships |
||||
|
||||
### 5. Select child table from drop down menu |
||||
|
||||
### 6. Click on 'Save' |
||||
|
||||
A new column will get created in both the parent table & child table |
||||
|
||||
## Updating linked records |
||||
|
||||
### 1. Open link record tab |
||||
|
||||
Click on the '+' icon in corresponding row - cell |
||||
<img width="750" alt="image" src="https://user-images.githubusercontent.com/35857179/189106326-90e46156-798d-4a01-a4eb-4e991ce94c03.png"> |
||||
|
||||
### 2. Select from the option displayed |
||||
|
||||
Use 'Filter box' to narrow down on search items |
||||
You can opt to insert a new record as well, using "+ New Record" button |
||||
<img width="1014" alt="image" src="https://user-images.githubusercontent.com/35857179/189106494-4b49a200-a44f-41ae-8b54-93b18d867a04.png"> |
||||
|
||||
### 3. Column mapping showing "Has Many" relationship |
||||
|
||||
Sheet1 'has many' Sheet2 |
||||
|
||||
<img width="756" alt="image" src="https://user-images.githubusercontent.com/35857179/189106702-3b8d7a50-08f4-4a04-b2cb-16db0cf667b3.png"> |
||||
|
||||
### 4. Column mapping for "Belongs to" relationship [Automatically updated] |
||||
|
||||
Sheet2 'belongs to' Sheet1 |
||||
|
||||
<img width="574" alt="image" src="https://user-images.githubusercontent.com/35857179/189106731-59e5bc3c-bcc5-4796-b5b2-d9b5418bfe2b.png"> |
Loading…
Reference in new issue