Skip to main content

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​

ObjectKey fields
Ordercustomer (Reference), total (Number, auto)
OrderLineorder (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​

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:

  1. Open Automatic Value and enable it.
  2. Choose Set to the sum of a field.
  3. Select object OrderLine and field line_total (or unit_price if every line is a single amount with no quantity).
  4. Leave the filter empty so Bobuild sums lines linked to this order through the reference — or set an explicit filter such as order equals 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 total on 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.