Appearance
smart-forms/repeating-group-variable
warning Reports a variable on or below a repeating group whose value differs between repetitions, of which Smart Forms keeps one.What it checks
Each text/fhirpath variable on a group that repeats, or on an item below one, that another expression references or may reference. It reports the variable when its value can differ between repetitions: its expression reads the item it is evaluated on, other than its linkId, or uses %context, or it references such a variable on the same item.
Example
%dose is calculated for each repetition of item "Medication" (medication), but Smart Forms keeps one value, so every repetition gets the value calculated for one of them, usually the last.
fsh
Instance: repeating-group-variable-reads-input
InstanceOf: Questionnaire
Usage: #example
* status = #draft
* item[0].linkId = "g"
* item[=].type = #group
* item[=].text = "Medication"
* item[=].extension.url = "http://hl7.org/fhir/StructureDefinition/variable"
* item[=].extension.valueExpression.name = "v"
* item[=].extension.valueExpression.language = #text/fhirpath
* item[=].extension.valueExpression.expression = "item.where(linkId = 'a').answer.value"
* item[=].repeats = true
* item[=].item[0].linkId = "a"
* item[=].item[=].type = #string
* item[=].item[=].extension.url = "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression"
* item[=].item[=].extension.valueExpression.language = #text/fhirpath
* item[=].item[=].extension.valueExpression.expression = "%v"