Count related records with a Formula field
Add a count to a parent record and verify that it follows the intended relationship.
Use a Formula field on a parent table to count the records linked below each parent. For example, show how many requests are attached to each project.
Set up the count on the parent table
- Start with tables that already have a parent relationship. For the example, use Projects as the parent of Requests. Pick a test project with two requests you can open.
- In Settings → Database, select the parent table. In Fields, add a Formula field such as Request count. In its Options cell, select Configure.
- In the formula editor, type
COUNTand choose the suggestion that includes the intended related table and path. A simple relationship can look likeCOUNT(@Requests). Keep the expression inserted by Mainbase, especially if there are several paths to the same table.
Verify the count
In Result, select your test project and compare the count with the related-record tab. For a count through the direct relationship, check the Direct connection type when that filter is available. Then check a different project. Save the formula and verify the value in the parent table.
If the number differs from what you expected, check how the related records are connected and whether you can open them. A formula can only count the records that are readable for the calculation.
Ask Mainbase AI
Ask about any feature in Mainbase. Find a setting, get step-by-step guidance, or troubleshoot a problem.
Open the AI assistantCopy a question to get started
- How do I create a Kanban view?
- How do I invite a teammate?
- Why is a record missing from this view?