Links

The Links field type is deprecated. New link fields are created as Link to Another Record fields. Existing Links fields can be upgraded to the new format.

Use the Links field type to make relationships between tables and to link records in other tables. NocoDB supports these types of relations:

RelationWhat it doesExample
Has-ManyA record in one table can have many records in another table.A Country can have many Cities.
Belongs-toMany records in one table can have one record in another table.A City Belongs-to a Country.
Many-to-ManyMany records in one table can have many records in another table.A Student can have many Subjects, and a Subject can have many Students.
Ask NocoAI

Copy a prompt, paste it into NocoAI in any base, and replace the words in [brackets] with your own.

  • Link [Orders] to [Customers] so each order belongs to one customer
  • Link [Projects] and [People] so a project can have many people and a person many projects
  • Link every record in [Orders] to the [Customers] record with the same [Email]
  • Show me the [orders] linked to this [customer]
  1. Click the + icon to the right of the Fields header.
  2. In the dropdown modal, enter the field name (optional).
  3. In the dropdown, select the field type Links.
  4. Select the relation type: One-to-one, Has-Many or Many-to-Many.
  5. Select the table to link to.
  6. Advanced settings (optional): configure the label that the cell shows. The defaults are Link and Links.
  7. Click the Save Field button.

image

You can limit the records that you can select in the Link records modal. Read more

Cell display

The cell shows the number of links from the record to the related table.

image

Click the link text. The Linked Records modal opens. It shows the list of links and more information about them.

List linked records

image

The list of linked records shows as a dropdown, with each linked record as a card. The modal has these parts:

  1. Search bar: use it to filter the list of linked records.
  2. Icon: shows a Many-to-Many relation. The count shows the number of linked records.
  3. List (cards) of linked records.
  4. <> icon: to see more information (expanded record), hover on the card and click the <> icon.
  5. - icon: click it to unlink the record.
  6. + New record button: click it to create a new record and link it to the current record.
  7. Link more records: click it to link an existing record. Read more
  8. Pagination bar.

To open the modal to add new links, do one of these:

  • Click the + Link more Records button in the Linked Records modal.
  • Click the cell, then click the + icon in the cell.

image

The modal has these parts:

  1. Search bar: use it to filter the list of records.
  2. Icon: shows a Many-to-Many relation. The count shows the number of linked records.
  3. List (cards) of records that you can link.
  4. <> icon: to see more information (expanded record) before you link, hover on the card and click the <> icon.
  5. + icon: click it to link the record.
  6. + New record button: click it to create a new record and link it to the current record.
  7. Pagination bar.
Multiple records can be linked at once

To unlink a record, open the Linked Records modal. Then click the - icon on the card of the record.

Multiple records can be unlinked at once

Limit record selection

Limit record selection sets which records you can select in the Link records modal of a Links field. It has two modes:

  • Limit by view
  • Limit by filter ☁

Notes:

  • You can use the two modes together. If you use both, you can select only the records that satisfy all conditions (the intersection).
  • This feature changes only the records that you can select. It does not change the existing links.
  • The limit applies only to the Link records modal. It does not stop link changes through the API, copy-paste or other methods.
  • The Limit by filter option is available on NocoDB Cloud (Plus plan and above) and licensed self-hosted deployments (Business plan and above).

If you configure no view under Limit by view, the Link records modal shows all records from the related table. NocoDB does not apply the filters of the default view of the related table, so you can select every record. NocoDB still uses the sort order of the default view to order the list. Record-level security rules always apply.

Limit by view

To limit the records that you can select to the records in a view, do these steps:

Steps

  1. Turn on Limit record selection to view.
  2. In the dropdown, select the view.
  3. Click the Save Field button.

image

In the example image above, you can select only the records in the Trailers view.

Notes:

  • You can select only one view.
  • If you delete the view that the links field uses, NocoDB turns off the limit by view option.
  • If you change the filters in the view, the records that you can select during linking also change.

Limit by filter ☁

To limit the records that you can select with filters, do these steps:

Steps

  1. Turn on Limit record selection by filter.
  2. Configure the filter:
  • Click the Add filter button.
  • Select the field and the operator.
  • Configure the value.
  1. Click the Save Field button.

image

In the example image above, you can select only the records in the Trailers view where rating is PG.

Notes:

  • You can add multiple filters.
  • If you delete a field that a filter of the links field uses, NocoDB turns off the related filters.

Filter Type

A condition in the filter can be one of two types:

TypeFilter value
Static conditionA constant value.
Dynamic conditionA field value from the current record.

To change a filter value between static and dynamic, use the ⚙️ icon to the right of the filter.

image image

A filter can have both static and dynamic conditions.

A dynamic condition can also compare linked records. Use it when the filter field is a Link field in the linked table, or a Lookup that ends in one. You then compare that field to a Link field on the current record. Both fields must point at the same table. The condition matches a record when the two fields share a minimum of one linked record. Its opposite matches when they share none.

NocoDB compares the linked records themselves, not their display values. Only the equality operators are available for this comparison.

Good to know

  • You can link only tables in the same database.
  • NocoDB supports self-referencing links (links to the same table).
  • For each Has-Many relation, NocoDB automatically adds a Belongs-to relationship field to the adjacent table.

Last updated on

Latest product updates?See Changelog
Stay in the loop? Follow us onLinkedInLinkedInYouTubeYouTubeXX