Stream: questionnaire
Topic: an item cannot have an answerExpression if answerValue...
Diane (Nov 18 2021 at 03:58):
@Paul Lynch asked me to bring up this topic for discussion.
For one section of our questionnaire, our intended design is to have the final question auto-populated for the users (based on the answers to the previous questions and based on answers in items in the parent questionnaire) using an answerExpression. However, there may be situations where the user didn't complete enough questions for the auto-populate to happen accurately. In that case, the users need to be able to answer manually, because the final question is mandatory (required).
In addition, we want to make sure that the users don't randomly enter things other than from a default drop-down list. So, I had added a answerOption.valueCoding to the item to allow for the manual selection in cases where auto-population doesn't occur.
Due to the constraint: "An item cannot have an answerExpression if answerOption or answerValueSet is already present", the answerExpression and the answerOption are mutually exclusive so I can't have both the autopopulate and the ability to select from the drop-down on the same question.
Paul has provided a suggested workaround where I can use an included valueSet in the answerExpression to be shown if the auto-populate doesn't occur.
What is the intent of the constraint: "An item cannot have an answerExpression if answerOption or answerValueSet is already present"? Paul was also wondering why this constraint was created.
Lloyd McKenzie (Nov 18 2021 at 14:13):
Population is handled by initialExpression
, not answerExpression
. answerExpression
just allows the dropdown to be dynamic instead of fixed.
Diane (Nov 18 2021 at 21:17):
So, I would place 2 extensions against the item? The answerExpression will create the dynamic drop-down and the initialExpression will populate the value from the parent questionnaire?
Brian Postlethwaite (Nov 18 2021 at 21:40):
Answer3xpression yes, for dropdown values. If intended to change answer dynically from other questions, that's calculatedExpression.
Brian Postlethwaite (Nov 18 2021 at 21:41):
InitialvalueExtension is just for setting the initial value prior to data entry, no expectation of change.
Last updated: Apr 12 2022 at 19:14 UTC