View raw Markdown
type: fhirpath-operatoroperator: ascategory: Typessection: 6.3.3source: fhirpath/operations.json

FHIRPath Operator: as (as)

If the left operand is a collection with a single item and the second operand is an identifier, this operator returns the value of the left operand if it is of the type specified in the second operand, or a subclass thereof. If the identifier cannot be resolved to a valid type identifier, the evaluator will throw an error. If there is more than one item in the input collection, the evaluator will throw an error. Otherwise, this operator returns the empty collection.

A type specifier is an identifier that must resolve to the name of a type in a model. Type specifiers can have qualifiers, e.g. FHIR.Patient, where the qualifier is the name of the model.

Observation.component.where(value as Quantity > 30 'mg')

Summary

Description

Returns the value of the left operand if it is of the type specified in the second operand, or a subclass thereof. The left operand must be a collection with a single item and the second operand must be a type identifier. Returns empty collection if the value is not of the specified type.

Type Mapping