-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repeated Group: Anomalous behaviour of enableWhen expressions in a repeated group #2590
Comments
thanks @allan-on can you share your questionnaire? |
Hi @jingtang10 This is the Questionnaire I used in the demo above: {
"resourceType": "Questionnaire",
"item": [
{
"linkId": "1",
"type": "group",
"text": "Repeated Group",
"repeats": true,
"item": [
{
"linkId": "1-2",
"type": "choice",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "drop-down",
"display": "Drop down"
}
],
"text": "Drop down"
}
}
],
"text": "Sample dropdown question",
"answerOption": [
{
"valueCoding": {
"code": "answer-a",
"display": "A"
}
},
{
"valueCoding": {
"code": "answer-b",
"display": "B"
}
},
{
"valueCoding": {
"code": "answer-c",
"display": "C"
}
},
{
"valueCoding": {
"code": "answer-other",
"display": "Other"
}
}
],
"item": [
{
"linkId": "1-3-1",
"text": "Dropdown question helper text",
"type": "display",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "flyover",
"display": "Fly-over"
}
],
"text": "Flyover"
}
}
]
}
]
},
{
"linkId": "1-1",
"text": "Sample date question",
"type": "date",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/entryFormat",
"valueString": "yyyy-mm-dd"
},
{
"url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression",
"valueExpression": {
"language": "text/fhirpath",
"expression": "%resource.descendants().where(linkId='1-2').answer.value.code = 'answer-a'"
}
}
]
}
]
}
]
}
|
@allan-on Can you please check whether posted questionnaire has the enable-when expression? |
Hi @santosh-pingle. I'm sorry about that. I've updated the sample I shared earlier. |
Hey @allan-on i'm not sure i agree with the use of I think the best way to handle this is actually use enable when element defined in the questionnaire base spec. Take a look at the comemnts section of this element: https://build.fhir.org/questionnaire-definitions.html#Questionnaire.item.enableWhen.question it very clearly defines the order or traversal so I think the behaviour is more predictable. |
Hey @allan-on, I posted a question on fhir chat https://chat.fhir.org/#narrow/stream/179266-fhirpath/topic/parent.28.29.20or.20siblings.28.29.3F and I've yet to try this method. But I've I tried to use enable when statement instead of enablewhen expression, and I tried the following questionnaire:
which worked with #2597 which I've just sent out. |
Thanks @jingtang10 and @santosh-pingle for working on this! |
Describe the bug
The
enableWhen
expression condition cascades to other group items below or above the trigger group item.Component
SDC library
To Reproduce
Steps to reproduce the behaviour:
Expected behaviour
For an enableWhen expression condition that affects a single field should not cascade to other fields.
Screenshots
repeated_group_enable_when_anomaly.mp4
Smartphone (please complete the following information):
Additional context
In the video shared above, there are two fields, a choice option, and a date field.
The date field only shows if the choice is option A.
Selecting option A shows all date fields and selecting any other option hides it.
Would you like to work on the issue?
Please state if this issue should be assigned to you or who you think could help to solve this issue.
The text was updated successfully, but these errors were encountered: