Sum prices of related records
Roll up line amounts onto a parent — for example the total of an order from all its items. Use an auto field with a sum formula on connected records.
When to use this
- Order total from order lines
- Invoice subtotal from invoice rows
- Ticket cost from time entries or parts
If you only need a total while filling one form (no related rows), use a form Live formula instead.
Data model
| Object | Key fields |
|---|---|
| Order | customer (Reference), total (Number, auto) |
| OrderLine | order (Reference → Order), product (optional Reference), quantity (Number), unit_price (Number), line_total (Number, optional auto or live formula) |
Put the Reference on the child (OrderLine.order). That is the usual one-to-many pattern — see Data modeling.
Steps
1. Line amount (optional but recommended)
Each line should expose a single number you can sum.
Option A — store line_total with an auto field on OrderLine:
- Enable Automatic Value → Set to a numeric expression
- Expression:
{quantity} * {unit_price}
Option B — live formula on the line form for instant feedback while typing; still prefer an auto field if other pages, tasks, or the order total must read a stored value.
2. Order total
On Order, create a Number field total:
- Open Automatic Value and enable it.
- Choose Set to the sum of a field.
- Select object OrderLine and field
line_total(orunit_priceif every line is a single amount with no quantity). - Leave the filter empty so Bobuild sums lines linked to this order through the reference — or set an explicit filter such as
orderequals the current record if you configure related records that way.
The field is read-only in the UI and recalculates when lines change.
3. Show it
- Put
totalon the order Detail and on grids. - Optionally use KPI Cards for a prominent total on the order page.
Tips
- Sum the line total, not raw
unit_price, when quantities matter. - For large imports, disable automatic fields, import, then re-enable and wait for recalculation.
- Count of lines uses the same pattern with Set to the count of records of type instead of sum — see Count open children and Auto fields.
Related
- Line total with a live formula — instant quantity × price on the form
- Dropdown of options with prices — fill
unit_pricefrom a product catalogue - Discount tiers — percentage off the subtotal
- Count open children — count instead of sum
- Auto fields
- Customer portal tutorial — Order / OrderLine blueprint