---
title: "Linked records, lookups and rollups in Softr Databases"
description: "Connect tables with related record fields, show data from linked records with lookups, and count or total it with rollups. Steps and formulas for each field."
canonical: "https://docs.softr.io/databases/linked-records"
updated: "2026-12-04"
---

# Linked records, lookups and rollups in Softr Databases

Related record, lookup and rollup fields connect the tables of a database. A related record field links a record to records of another table. A lookup shows a value from the linked record. A rollup counts or totals values across linked records.

![The Projects table, with four fields outlined: Client and Invoices are related record fields, Client phone is a lookup of the client's phone, and Total invoiced is a rollup that adds up the invoices](/databases/linked-records/links-in-a-table.2x.webp)

| Field              | What it does                             | Use it to                                                |
| ------------------ | ---------------------------------------- | -------------------------------------------------------- |
| **Related record** | Connects records between two tables      | Assign tasks to employees, or projects to clients        |
| **Lookup**         | Shows a field of the linked record       | Show a client's phone number in the projects table       |
| **Rollup**         | Aggregates a field across linked records | Total the invoices of a project, or count its open tasks |

## Related records

A related record field (also called a relationship field) connects a record in one table to records in another. Use it instead of copying the same data into both tables.

### Set up a related record field

1. Open your database and select the table that gets the field.
2. Select **Add field** at the end of the table header.
3. Select **Related record** as the field type.
4. Choose the **Related table** to link to. For example, link a "Projects" table to a "Clients" table.
5. Turn **Allow linking to multiple records** on or off in the field of each table. The two settings decide whether the relationship is one-to-one, one-to-many or many-to-many.
6. Name the field and select **Save**.

Softr creates the matching related record field in the linked table. A change in one table shows in the other.

![The field editor of the Client field: Field type Related record, with Related table set to Clients and Allow linking to multiple records off, both outlined. Below are Selectable records and Default record](/databases/linked-records/related-record-field.2x.webp)

For example, a related record field in "Tasks" assigns each task to a person from "Users". Each task then shows its employee, and each employee shows all their tasks.

## Lookup fields

A lookup field shows a field of a linked record, so you don't copy the data by hand. It needs a related record field first.

### Set up a lookup field

1. In the table with the related record field, select **Add field**.
2. Select **Lookup** as the field type.
3. Under **Look up value for related...**, choose the related record field that connects to the other table.
4. Under **Field to look up**, choose the field of the linked table to show, such as "Phone".
5. If the related field links several records, open **Record Options** to **Sort** or **Filter** the linked records. Turn on **Limit number of records** and set the **Maximum number of records** to show only the first ones.
6. Name the field and select **Save**.

![The field editor of the Client phone field: Field type Lookup, the related field Client, and Field to look up set to Phone, outlined](/databases/linked-records/lookup-field.2x.webp)

A lookup field is read-only and updates when the source data changes. For example, a lookup in "Projects" shows each client's phone number next to the project details.

## Rollup fields

A rollup field aggregates a field across linked records with a formula. It needs a related record field first.

### Set up a rollup field

1. In the table with the related record field, select **Add field**.
2. Select **Rollup** as the field type.
3. Under **Related records to roll up from**, choose the related record field.
4. Under the next setting (**'Invoices' field to roll up** for an Invoices field), choose the field of the linked table to aggregate, such as "Amount".
5. Under **Aggregation formula**, choose how to combine the values.
6. Name the field and select **Save**.

![The field editor of the Total invoiced field: Field type Rollup, rolling up the Amount field of the related Invoices, with Aggregation formula set to SUM, outlined](/databases/linked-records/rollup-field.2x.webp)

These are the aggregation formulas:

| Formula        | What it returns                                                                                  |
| -------------- | ------------------------------------------------------------------------------------------------ |
| `MIN`          | The lowest numeric value                                                                         |
| `MAX`          | The highest numeric value                                                                        |
| `SUM`          | The total of the numeric values                                                                  |
| `AVERAGE`      | The average of the numeric values                                                                |
| `COUNT`        | The number of non-empty numeric values                                                           |
| `COUNTA`       | The number of non-empty text or numeric values                                                   |
| `COUNTALL`     | The number of all values, including empty ones                                                   |
| `ARRAYJOIN`    | All elements joined into one string, separated by semicolons, for example \[1, 2] becomes "1; 2" |
| `ARRAYUNIQUE`  | The values without duplicates, keeping the first of each                                         |
| `ARRAYCOMPACT` | The values without blank or empty elements                                                       |
| `ARRAYFLATTEN` | Nested lists made into one list, for example \[\[1], \[2, 3]] becomes \[1, 2, 3]                 |

> **Tip**
>
> To count the linked records, use `COUNTALL`.

For example, a rollup in "Projects" with `SUM` on the "Invoice amount" of linked invoices shows the total invoiced for each project. A rollup updates when the linked records change.

## Plan your links

- **Name tables after things.** Think about the nouns of your app (Clients, Projects, Invoices) and keep adjectives for fields such as **Category**, **Type** or **Status**.
- **Name link fields clearly.** For example, "Client name" or "Total invoiced".
- **Check rollup results.** Test complex aggregations on a few records.
- **Keep lookups and rollups few.** Too many can slow down your database, so add only what your app shows.

## Troubleshooting

| Problem                                 | What to check                                                                   |
| --------------------------------------- | ------------------------------------------------------------------------------- |
| A related record field shows no records | Both tables are in the same database, and the field is set up correctly         |
| A lookup field is blank                 | The related record field has linked records, and the field you look up has data |
| A rollup field shows errors             | The formula suits the data, for example numbers for `SUM`, `MIN` and `MAX`      |

## FAQ

**Can I edit the value of a lookup or a rollup?**

No. Lookup and rollup fields are read-only. They update by themselves when the linked records change. To change the value, edit the field in the linked record.

**Why does my lookup show several values?**

A lookup shows the field of every linked record. If the related record field links three invoices, the lookup shows three values. To show fewer, turn on **Limit number of records** in the lookup settings. To show one result, such as a total or a count, use a rollup instead.

**Can a lookup show data from a table in another database?**

No. A related record field links tables of the same database, and lookups and rollups follow that link. To use data from another database, import or copy it into this database, or link the records with a workflow.
