startingClause

Specifies the initial accumulator value for an aggregate clause. May be a simple literal, a quantity, or a parenthesized expression. When omitted, the accumulator starts as null.

Examples

Starting from zero

from [Observation] O
  aggregate Total starting 0: $total + O.value

Starting from an empty string

from Items I
  aggregate Result starting '': $total + I.label + ', '

Starting from a parenthesized expression

from [Observation] O
  aggregate Count starting (0 as Integer): $total + 1
Railroad Diagram
100%
starting simpleLiteral quantity ( expression )

scroll to zoom · drag to pan · click green rules or blue tokens to navigate

EBNF

startingClause
  : 'starting' (simpleLiteral | quantity | ('(' expression ')'))
  ;

Used In