First a bit of background. I am not a programmer. I'm a nurse who also happens to be a bit of a geek and would love to be a programmer. I've recently started working in our Digital team at the hospital I work at and we have a contract with, and use InterSystems Trakcare. As part of this we create Questionnaires for our clinicians to use and in these questionnaires we can add what InterSystems refer to as "Expressions", which I'm told are written in cache script. I have a questionnaire that I'd like an expression that checks if a question has been answered before writing a message, but I have no idea how to do that.
The only expressions I've written so far have been to write a message based on a score value, and to do those I had to look at Questionnaires created by Intersystems and basically copy their code.
There is a questionnaire that has the following expression, that seems to retrieve data from questions within it's questionnaire but I'm beggared if I can work it out or get it working in my questionnaire. So I'm hoping someone can talk me through this code and explain what each line does.
Do ##Class(websys.Component).GetComponentMessages(.t,"questionnaire.QTC4AT.Edit")
set score=obj.QUESScore
set sr1=$get(t("Q48"),">= 4: Possible delirium +/- cognitive impairment")
set sr2=$get(t("Q49"),"1-3: Possible cognitive impairment")
set sr3=$get(t("Q50"),"0: Delirium or severe cognitive impairment unlikely (but delirium still possible if [4] information incomplete)")
set srx=""
if (score'="") set srx="No valid score"
if ((score'="") && (score>=4)) set srx=sr1
if ((score'="") && (score>=1) && (score<=3)) set srx=sr2
if ((score'="") && (score=0)) set srx=sr3
write srx
I know you probably have better ways to spend your time but thank you :)