Hello,
I am trying to get the allergy reactions to display in a letter or handout. It worked in older versions, but I can't seem to make it work in CPS 12.0.12.
Does anyone have any suggestions?
Thank you in advance for your help!
Vicky
The Oregon Clinic - GI
Can you post your code that used to work?
Yes, sorry, I should have done that! I belive I got this from CHUG, then we did a few tweaks, but it doesn't seem to pull the reaction - it says "no reaction" when there is one in the system.
ALLERGY REACTION
{local titleA
titleA = ""
titleA = "Allergies and Adverse Reactions: "
local retListALL
retListALL = ""
local retA
retA = ""
retA = ALL_AFTER("delimited")
if retA = "" then retListALL = ""
else
retA = getfield(ALL_AFTER("delimited"),"|","")
for x = 1, x <= size(retA),x = x + 1
do
retA[x] = getfield(retA[x],"^","")
retListALL = retListALL + (if retListALL == "" then "" else HRET endif) +
retA[x][1] + " (" + retA[x][7] + ": " + if ret[x][5] == "" then "no reaction noted" else ret[x][5] endif + ")"
endfor
endif
retListALL = titleA + HRET + retListALL
retListALL}
TEST #1:
{local titleA
titleA = ""
titleA = "Allergies and Adverse Reactions: "
local retListALL
retListALL = ""
local retA
retA = ""
retA = ALL_AFTER("delimited")
if retA = "" then retListALL = ""
else
retA = getfield(ALL_AFTER("delimited"),"|","")
for x = 1, x <= size(retA),x = x + 1
do
retA[x] = getfield(retA[x],"^","")
retListALL = retListALL + (if retListALL == "" then "" else HRET endif) +
retA[x][1] + " (" + if ret[x][5] == "" then "no reaction noted" else ret[x][5] endif + ")"
endfor
endif
retListALL = titleA + HRET + retListALL
retListALL}
You have a couple of typos. You have ret[x][5] in your code twice and both instances should be retA[x][5]. That should fix it.
Fixing the "A" worked!! Totally missed that!
Thank you so much for your help!
Have a great day,
Vicky