For clause
For basic single field selections, a path like FhirPath statement is usually good enough, you need a table result and not separate fields.
Grouping
This example here will produce a separate list of given names and a list of family names.
from Patient select name.given, name.family
But if you want to produce a table from the name, you can use a for
statement:
from Patient for name select { given, family }
Note that there is no select after the from clause. This will produce a table with a row for each 'name', with two fields (given and family).
Because a for
clause produces a table, it's not often sensible to put into a field value.
It's usually combined with a join
:
from Patient select id, join for name select { given, family }