Appearance
sdc/undefined-variable
error Reports a %name that is not available where it is used.What it checks
Every %name in a FHIRPath expression at a catalogued location, and in each {{…}} fragment of an x-fhir-query there, is looked up among the names available at that place: the declarations on its item, its ancestor items and the root, such as variables, other named expressions and launchContexts; the names FHIRPath, FHIR and SDC define, such as %resource, %context and %qitem; in a module, the names its assembleContext lists; the names listed in hostVariables; and the names a listed plugin supplies. An expression used in extraction sees only extractAllocateId names and named extraction contexts among the declarations.
Example
%weigt is not available on item "BMI" (bmi).
fsh
Instance: undefined-variable-similar-name
InstanceOf: Questionnaire
Usage: #example
* status = #draft
* item[0].linkId = "bmi"
* item[=].type = #string
* item[=].text = "BMI"
* item[=].extension[0].url = "http://hl7.org/fhir/StructureDefinition/variable"
* item[=].extension[=].valueExpression.name = "weight"
* item[=].extension[=].valueExpression.language = #text/fhirpath
* item[=].extension[=].valueExpression.expression = "70"
* item[=].extension[+].url = "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression"
* item[=].extension[=].valueExpression.language = #text/fhirpath
* item[=].extension[=].valueExpression.expression = "%weigt / 2"