View raw Markdown
type: fhirpath-functionfunction: tracecategory: Utility functionssection: 5.10.1source: fhirpath/functions.json

FHIRPath Function: trace

This is a scoped function: If no projection argument is provided, the input collection is logged without the need for scoping. If the projection argument is provided, it is evaluated for each item (setting $this and $index before each iteration) and the result logged. The input collection is returned as the result of the function.<br/> The name parameter 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.

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

Summary

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

Type Mapping

Example

contained.where(criteria).trace('unmatched', id).empty()