Fetch
Syntax
fetch-declaration: fhirpath-expression 'fetch' fetch-dereference
fetch-dereference: field | group
Functionally
The fetch declaration interprets the the value of a field as a reference to another resource. When the field is a canonical, it will fetch the resource with that canonical. If it's a regular reference, it will fetch the resource with the matching type and id.
Example
The following example will show the name of the profile that the patient resource claims to conform to:
from Patient
select
id,
meta.profile fetch name,
name[0].given[0],
name[0].family
The following example shows how to get multiple values from another resource:
from Patient
select
id,
meta.profile fetch { name, differential.element.count()" }