Link to Another Record

This article explains how to create & work with a Link to Another Record field.

Link to Another Record field type is used to establish relationships between tables & create links to other records. NocoDB supports the following types of relations:

  • One-to-Many - A record in one table can link to multiple records in another table.
    • Example: A Country can have multiple Cities.
  • Many-to-One - Multiple records in one table link to a single record in another table.
    • Example: A City belongs to a Country.
  • Many-to-Many - Multiple records in both tables can link to each other.
    • Example: A Student can have multiple Subjects & a Subject can have multiple Students.
  • One-to-One - A record in one table links to exactly one record in another table.
    • Example: A Country has one Capital.

One-to-Many and Many-to-One are also commonly referred to as Has-Many and Belongs-to respectively.

  • Links can be created only between tables in the same database.
  • Self-referencing links are supported. (Link to the same table)
  • For every One-to-Many relation defined, NocoDB augments a Many-to-One relationship field in the related table automatically.
  1. Click on + icon to the right of Fields header
  2. On the dropdown modal, enter the field name (Optional).
  3. Select the field type as Link to Another Record from the dropdown.
  4. Select the relation type: One-to-One, One-to-Many, Many-to-One, OR Many-to-Many.
  5. Select the table to which the relation is to be established with.
  6. Click on Save Field button.

You can control record visibility in the Link records modal by limiting the records available for selection. Read more

Cell display

The cell displays linked records as chips, showing the primary display value of each linked record.

image

Clicking on the expand icon will open a Linked Records modal with the full list of links & associated additional information.

List linked records

image

List of linked records will appear as a dropdown containing linked records as cards. A brief note about the modal components:

  1. Search bar, to narrow down the list of linked records displayed
  2. Icon represents the relation type. The count indicates the number of linked records
  3. List (cards) of linked records
  4. To view additional information (expanded record), hover on the card & click on the expand icon
  5. Click on the - icon to unlink the record
  6. Click on + New record button to create and link a new record to the current one
  7. Click on Link more records to link an existing record Read more

Modal to add new links can be opened by

  • Clicking on + Link more Records button in the Linked Records modal
  • Clicking on the + icon in the cell (appears on clicking on the cell)

image

A brief note about the modal components:

  1. Search bar, to narrow down the list of records displayed
  2. Icon represents the relation type. The count indicates the number of linked records
  3. List (cards) of records available for linking
  4. To view additional information (expanded record) before linking, hover on the card & click on the expand icon
  5. Click on the + icon to link the record
  6. Click on + New record button to create and link a new record to the current one
Multiple records can be linked at once

To unlink a record, open the Linked Records modal & click on the - icon on the card of the record to be unlinked.

Multiple records can be unlinked at once

Limit record selection

This feature enables users to restrict the records available for selection within the Link records modal. This can be achieved by two modes:

  • Limit by view
  • Limit by filter ☁

Note that,

  • These options are not mutually exclusive & can be used together. When both are used, the records available for selection will be the intersection of the records satisfying all conditions.
  • This feature only affects the records available for selection & does not affect the existing links.
  • The limit is applied only on the Link records modal & does not restrict the link modification process via API, Copy-Paste or any other mechanisms.
  • Limit by filter option is available only in cloud version.

Limit by view

To limit the records available for selection based on a view, follow the steps below:

Steps

  1. Enable Limit record selection to view
  2. Select the view from the dropdown
  3. Click on Save Field button

image

In the example image above, the records available for selection will be limited to the records available in Trailers view.

Note that,

  • Only one view can be selected at a time.
  • Deleting the view associated with the link field will disable the limit by view option.
  • Change in filters within the view will also reflect records available for selection during linking.

Limit by filter ☁

To limit the records available for selection based on filters, follow the steps below:

Steps

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

image

In the example image above, the records available for selection will be limited to the records available in Trailers view where rating is PG.

Note that,

  • Multiple filters can be added.
  • Deleting the field associated with the link field will disable associated filters.

Filter Type

Conditions in the filter can be of two types: Static & Dynamic.

  • Static condition: Filter value is a constant value.
  • Dynamic condition: Filter value is a field value from the current record.

Use the ⚙️ icon to the right of the filter to toggle between static & dynamic filter values.

image image

Note that, it's allowed to have a mix of static & dynamic conditions in the filter.

If your base has existing Links fields (the older field type that displayed only a count of linked records), you can upgrade them to Link to Another Record fields.

The upgrade option is available in two places:

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

image

  • Open the field editor — a banner will indicate that a newer version is available with an Upgrade button

image

A confirmation dialog will appear before the upgrade is applied.

image

This change cannot be undone.

After upgrading:

  • Your data will not be affected.
  • The original field will show only the count of linked records (converted to a Rollup field).
  • A new Link to Another Record field will be added next to it to display the actual linked records.
Before upgradeAfter upgrade
imageimage