FHIRPath Function: trace
This is a scoped function: If no
projectionargument is provided, the input collection is logged without the need for scoping. If theprojectionargument is provided, it is evaluated for each item (setting$thisand$indexbefore each iteration) and the result logged. The input collection is returned as the result of the function.<br/> Thenameparameter is evaluated before the function is executed and is not re-evaluated for each iteration of the projection.
Adds a String representation of the input collection to the diagnostic log, using the name argument as the name in the log. This log should be made available to the user in some appropriate fashion. Does not change the input, so returns the input collection as output.
If the projection argument is used, the trace would log the result of evaluating the project expression on the input, but still return the input to the trace function unchanged.
contained.where(criteria).trace('unmatched', id).empty()
The above example traces only the id elements of the result of the where.
Summary
- Category: Utility functions
- Section:
5.10.1 - Return Type:
collection - Empty Input Result:
empty - Errors on Multiple Input:
false
Description
Adds a String representation of the input collection to the diagnostic log, using the name argument as the name in the log. Does not change the input, so returns the input collection as output.
Arguments
name:String- Name to use in the logprojection(optional):Expression- Optional expression to project for logging
Type Mapping
Example
contained.where(criteria).trace('unmatched', id).empty()