FHIRPath Function: where
This is a scoped function: The
criteriaargument is evaluated for each item (setting$thisand$indexbefore each iteration); those that returntrueare 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')
Summary
- Category: Filtering and projection
- Section:
5.2.1 - Return Type:
collection - Empty Input Result:
empty - Errors on Multiple Input:
false
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')