What am I missing here?
I am trying to set an order to auto generate based on OBSNOW("PQRI MEAS 47") <> "" but am not having luck.
I even tried placing a super button to generate this order and others but cannot get this to work.
{if OBSNOW("PQRI MEAS 47") <> "" then MEL_ADD_ORDER("S", "Family Practice", "Advanced Directive Discussion", "", "ICD10-Z00.00", "Preventative Health Care", "", "", "", "", "") else "" endif}
Eliminate the "if then else" statement, just put the MEL_ADD_ORDER function in a button and see if that works first.
The MEL_ADD_ORDER works by itself. The "if then else" statement causes GE to lock up and crash. Though it does put the order in before it crashes.
What values are being put into the OBS term "PQRI MEAS 47"?
I have a checkbox that adds the value "Discussed Advance care planning"
Looking back at your original post, looks like you have a single quote after PQRI MEAS 47
I double checked that one and the one after ICD10-Z00.00 as that appeared in this post as a single quote as well. Both have been confirmed as double quotes.
What program are you writing this code into? I pasted into the VFE function view and some of your quotes are a different format.
I also using VFE (v8.04). I also noticed some differences in format when I copied and pasted from this post. However they appeared correctly in VFE. Just to be sure I did retype the entire thing and still get the same result. Thanks for spending so much time trying to help me figure this out!
Try running a MEL trace and looking at the output when Centricity crashes. That might give you an idea. I have had situations in the past where the code I thought was the issue, turned out not to be the reason for the crash.
Brad
{IF OBSNOW("PQRI MEAS 47") == “”
THEN ""
ELSE MEL_ADD_ORDER(“S”, “Family Practice”, “Advanced Directive Discussion”, “”, “ICD10-Z00.00″, “Preventative Health Care”, “”, “”, “”, “”, “”)
ENDIF}
could give that a try, its essentially the same thing but it worked for me.
we have something similar in our forms, it also looks for the order code so it doesn't add repeatedly.
{if OBSNOW("BMI")"" and OBSNOW("BMI")>=25 and match(ORDERS_NEW("LIST","S"),"238131007")=0 then MEL_ADD_ORDER("S","PQRI","SNOMED-CT: 238131007 BMI >=25","","","","","","","","") else "" endif}