Link to Another Record

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

RelationWhat it doesExample
One-to-ManyA record in one table links to many records in another table.A Country can have many Cities.
Many-to-OneMany records in one table link to one record in another table.A City belongs to a Country.
Many-to-ManyMany records in both tables can link to each other.A Student can have many Subjects, and a Subject can have many Students.
One-to-OneA record in one table links to exactly one record in another table.A Country has one Capital.
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]
  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 Link to Another Record.
  4. Select the relation type: One-to-One, One-to-Many, Many-to-One or Many-to-Many.
  5. Select the table to link to.
  6. Click the Save Field button.

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

Cell display

The cell shows linked records as chips. Each chip shows the primary display value of the linked record.

image

Click the expand icon. The Linked Records modal opens. It shows the full 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 the relation type. The count shows the number of linked records.
  3. List (cards) of linked records.
  4. Expand icon: to see more information (expanded record), hover on the card and click the expand 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

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 the relation type. The count shows the number of linked records.
  3. List (cards) of records that you can link.
  4. Expand icon: to see more information (expanded record) before you link, hover on the card and click the expand 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.
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. There are 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 link 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 link 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.

Custom display value field ☁

By default, a Link to Another Record field shows the primary display value of each linked record. This is the title column of the linked table. It shows in cells, link pickers and expanded forms. Use the Custom display value field option to change this for one link field. You can show any column from the linked table.

Use this option when the primary display value of the linked table is not the most useful identifier. For example, on a Deals → Contacts link in a CRM, you can show the email or phone of the contact, not the full name.

This feature is available on all NocoDB Cloud plans and licensed self-hosted deployments (Business plan and above).

Steps

  1. Open the field editor for the Link to Another Record field.
  2. Turn on the Use custom display value field toggle.
  3. In the dropdown, select the column from the linked table to use as the display value.
  4. Click the Save Field button.

image

NocoDB then uses the selected column as the display value in these places:

  • Where it shows linked records: cell pills, link picker, expanded forms, and calendar and timeline inline cards.
  • Where it refers to linked records: search, filter, sort, group-by, formula and audit log entries.

The setting stays after export, import and project duplication.

Your project can have existing Links fields. This is the older field type that shows only a count of linked records. You can upgrade these fields to Link to Another Record fields.

You can start the upgrade in two places:

  • Right-click a Links field header and select Upgrade field.

image

  • Open the field editor. A banner tells you that a newer version is available, and shows an Upgrade button.

image

A confirmation dialog opens before NocoDB applies the upgrade.

image

This change cannot be undone.

After the upgrade:

  • Your data does not change.
  • The original field shows only the count of linked records. NocoDB converts it to a Rollup field.
  • NocoDB adds a new Link to Another Record field next to it. The new field shows the linked records.
Before upgradeAfter upgrade
imageimage

Good to know

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

Last updated on

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