View raw Markdown
type: fhir-fhirpath-functionsource: source/fhirpath.html

FHIR FHIRPath Function: hasValue

This page is part of FHIR FHIRPath (FHIR-specific extensions). Base spec lives at FHIRPath.

hasValue() : Boolean

If the input collection contains a single value which is a FHIR primitive, then will return true if the single value is a primitive value (e.g., as opposed to not having a value and just having extensions) and false if not. If the input collection isn't a single FHIR primitive, the return value is empty.

Note to implementers: The FHIR conceptual model talks about "primitives" as subclasses of the type Element that also have id and extensions. What this actually means is that a FHIR primitive is not a primitive in an implementation language. The introduction (section 2 above) describes the navigation tree as if the FHIR model applies - primitives are both primitives and elements with children.

In FHIRPath, this means that FHIR primitives have a value child, but, as described above, they are automatically cast to FHIRPath primitives when comparisons are made, and that the primitive value will be included in the set returned by children() or descendants().

Patient.active.hasValue()


Back to FHIR FHIRPath