Appearance
smart-forms/named-expression-not-referenceable
error Reports a reference to a named expression that Smart Forms does not make available to other expressions.What it checks
Every %name reference in a FHIRPath expression that the selected Smart Forms renderer or population evaluates, when the name refers to a declaration Smart Forms stores no value for: a named calculatedExpression, initialExpression, enableWhenExpression, answerExpression, candidateExpression, contextExpression, answerOptionsToggleExpression, targetConstraint or cqf-expression; an itemPopulationContext population does not read; or an itemExtractionContext. At an answerExpression it also reports a first name that is neither a launch context nor an application/x-fhir-query variable that expands a ValueSet, and every other name the expression references.
Example
%score refers to the calculatedExpression on item "Score" (score), which Smart Forms does not make available to other expressions, so the reference never gets its value.
fsh
Instance: named-expression-not-referenceable-calculated-expression
InstanceOf: Questionnaire
Usage: #example
* status = #draft
* item[0].linkId = "score"
* item[=].type = #integer
* item[=].text = "Score"
* item[=].extension[0].url = "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression"
* item[=].extension[=].valueExpression.name = "score"
* item[=].extension[=].valueExpression.language = #text/fhirpath
* item[=].extension[=].valueExpression.expression = "1 + 1"
* item[=].extension[+].url = "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression"
* item[=].extension[=].valueExpression.language = #text/fhirpath
* item[=].extension[=].valueExpression.expression = "%score > 0"