type: fhirpath-functionfunction: aggregatecategory: Aggregatessection: 7.1source: fhirpath/functions.json
FHIRPath Function: aggregate
No canonical section match found in index.md.
Summary
- Category: Aggregates
- Section:
7.1 - Return Type:
value - Empty Input Result:
empty - Errors on Multiple Input:
false
Description
Performs general-purpose aggregation by evaluating the aggregator expression for each element of the input collection. Within this expression, the standard iteration variables of $this and $index can be accessed, but also a $total aggregation variable.
Arguments
aggregator:expression- Expression to evaluate for each elementinit(optional):value- Initial value for the accumulator
Type Mapping
Example
value.aggregate($this + $total, 0)