Stream: questionnaire
Topic: enableWhen() != operator on coding
Yunwei Wang (Jul 16 2020 at 20:52):
when using LHC form, I noticed that != operator has the same effect as = operator on coding. Here is an example
{
"linkId": "4.1",
"text": "Diagnosis",
"type": "choice",
"required": true,
"answerOption": [
{
"valueCoding": {
"code": "Diabetes",
"display": "Diabetes"
}
},
{
"valueCoding": {
"code": "Other",
"display": "Other"
}
}
]
},
{
"linkId": "4.2",
"text": "Diabetes Treatment",
"type": "choice",
"required": true,
"enableWhen": [
{
"question": "4.1",
"operator": "=",
"answerCoding": {
"code": "Diabetes"
}
}
],
"answerOption": [
{
"valueCoding": {
"code": "Insulin Treated",
"display": "Insulin Treated"
}
},
{
"valueCoding": {
"code": "Non-insulin Treated",
"display": "Non-insulin Treated"
}
}
]
},
{
"linkId": "4.3",
"text": "Other Diagnosis Description",
"type": "string",
"required": true,
"enableWhen": [
{
"question": "4.1",
"operator": "!=",
"answerCoding": {
"code": "Diabetes"
}
}
]
}
when selecting "Diabetes" in 4.1, form shows both 4.2 and 4.3 shows. when selecting "Other" in 4.1, form shows neither 4.2 nor 4.3
Is that a bug?
This is tested on https://lhcforms.nlm.nih.gov/lhcforms
@Paul Lynch
Paul Lynch (Jul 16 2020 at 21:12):
Yunwei Wang said:
Is that a bug?
Paul Lynch
Yes, most likely. Your item definitions look correct to me. We are looking into it.
Paul Lynch (Jul 20 2020 at 14:26):
Paul Lynch said:
Yunwei Wang said:
Is that a bug?
Yes, most likely. Your item definitions look correct to me. We are looking into it.
This was a bug, and is fixed in version 25.1.2 of LHC-Forms. It might take a week for the fix to make it into our demos/apps (including https://lhcforms.nlm.nih.gov/lhcforms) but if you are installing LHC-Forms directly the fix is available.
Last updated: Apr 12 2022 at 19:14 UTC