You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`summaryOperations` gains an optional `filter` — a query `where`
FilterCondition evaluated against each child row — so a roll-up `summary`
field aggregates only the matching children instead of the whole child
collection. This is the piece the cross-object rollup templates were
missing: it lets a single child object feed several distinct parent totals
(e.g. content_publication.total_signups vs total_clicks over one engagement
child, or procurement_order.received_amount summing only received receipt
lines in a 3-way match).
The engine ANDs the predicate with the parent-FK match when it recomputes,
and because the whole filtered aggregate is re-run on every child
insert/update/delete, a child that moves in or out of the predicate
(a status change) keeps the parent current with no extra wiring. Operator
and compound filter forms work too.
Purely additive: omitting `filter` aggregates every child exactly as before.
- spec: add `summaryOperations.filter` (FilterCondition) + tests; regen
reference doc; note the sub-key in the liveness ledger
- objectql: thread the filter through SummaryDescriptor / buildSummaryIndex /
recomputeSummaries; tests for filtered sum/count, $in/$gte compounds, and
in/out-of-filter recompute on update & delete
- docs: document `filter` in field-types.mdx and the objectstack-data
relationships skill; fix a stale non-canonical summary example in that skill
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HbK4FqcHwp9jSwdhTtxYuC
Copy file name to clipboardExpand all lines: content/docs/references/data/field.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -132,7 +132,7 @@ const result = Address.parse(data);
132
132
|**allowCreate**|`boolean`| optional | Allow inline quick-create from the record picker: when no match exists the user can create a record from the typed text (optimistic dataSource.create with the display field). Best for simple objects whose only required field is the display field. |
"note": "rollup {object,field,function,relationshipField,filter}. `filter` (a query `where` FilterCondition) is read by buildSummaryIndex and ANDed with the parent-FK match in recomputeSummaries, so one child object can feed several filtered totals."
field: z.string().describe('Field on child object to aggregate (ignored for count)'),
403
404
function: z.enum(['count','sum','min','max','avg']).describe('Aggregation function to apply'),
404
405
relationshipField: z.string().optional().describe('FK field on the child pointing back to this parent. Auto-detected from the child\'s lookup/master_detail field referencing this object when omitted; set explicitly only when the child has more than one such reference.'),
406
+
/**
407
+
* Optional predicate that restricts WHICH child rows are aggregated — a
408
+
* FilterCondition (the same object DSL as a query `where`), evaluated against
409
+
* each child row. Omit to aggregate every child. This is what lets several
410
+
* summaries roll up the SAME child object into different totals — e.g.
411
+
* `content_publication.total_signups` = count of engagement rows where
412
+
* `{ type: 'signup' }` vs `total_clicks` where `{ type: 'click' }`, or
413
+
* `procurement_order.received_amount` = sum of receipt lines where
414
+
* `{ status: 'received' }`. The engine ANDs it with the parent-FK match, so
415
+
* a child moving in or out of the predicate (a status change) recomputes the
416
+
* parent on its next write like any other child update.
417
+
*/
418
+
filter: FilterConditionSchema.optional().describe("Predicate restricting which child rows are aggregated (a query `where` FilterCondition, e.g. { status: 'received' } or { type: { $in: ['signup','trial'] } }). Omit to aggregate all children. Lets one child object feed multiple filtered roll-ups."),
405
419
}).optional().describe('Roll-up summary definition. The engine recomputes the value when child records are inserted/updated/deleted.'),
0 commit comments