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

FHIRPath Function: where

This is a scoped function: The criteria argument is evaluated for each item (setting $this and $index before each iteration); those that return true are included in the output collection.

Returns a collection containing only those items in the input collection for which the stated criteria expression evaluates to true. Items for which the expression evaluates to false or empty ({ }) are not included in the result.

If the input collection is empty ({ }), the result is empty.

If the result of evaluating the condition is other than a single boolean value, the evaluation will end and signal an error to the calling environment, consistent with singleton evaluation of collections behavior.

The following example returns the list of telecom elements that have a use element with the value of 'official':

Patient.telecom.where(use = 'official')

<a name="fn-select"></a>

Summary

Description

Returns a collection containing only those elements in the input collection for which the stated criteria expression evaluates to true. Elements for which the expression evaluates to false or empty ({ }) are not included in the result.

Arguments

Type Mapping

Example

Patient.telecom.where(use = 'official')