View raw Markdown
type: fhirpath-functionfunction: ofTypecategory: Filtering and projectionsection: 5.2.7source: fhirpath/functions.json

FHIRPath Function: ofType

Returns a collection that contains all items in the input collection that are of the given type or a subclass thereof. If the input collection is empty ({ }), the result is empty. The type argument is an identifier that must resolve to the name of a type in a model. For implementations with compile-time typing, this requires special-case handling when processing the argument to treat it as type specifier rather than an identifier expression:

Bundle.entry.resource.ofType(Patient)

In the above example, the symbol Patient must be treated as a type identifier rather than a reference to a Patient in context.

<a name="coalesce"></a>

Summary

Description

Returns a collection that contains all items in the input collection that are of the given type or a subclass thereof.

Arguments

Type Mapping

Example

Bundle.entry.resource.ofType(Patient)