I am trying to program a couple G-codes into a form, I have them programmed but now every time the obsterms are changed, it adds another, change it back, it adds another. So even in the same instance it adds another order. Is there a way to program it so it won't add another instance?
Here is what I have thus far.
{
if OBSANY("SMOK STATUS") == "current every day smoker"
then MEL_ADD_ORDER("S", "Office Services", "SM - screened for tobacco use and received tobacco cessation intervention", "", "", "", "", "", "", "", "")
endif
}
{
if OBSANY("SMOK STATUS") == "current some day smoker"
then MEL_ADD_ORDER("S", "Office Services", "SM - screened for tobacco use and received tobacco cessation intervention", "", "", "", "", "", "", "", "")
endif
}
{
if OBSANY("SMOK STATUS") == "never smoker"
then MEL_ADD_ORDER("S", "Office Services", "SM - Current tobacco non-user", "", "", "", "", "", "", "", "")
endif
}
{
if OBSANY("SMOK STATUS") == ""
then MEL_ADD_ORDER("S", "Office Services", "SM - screened for tobacco use and received tobacco cessation intervention", "8P", "", "", "", "", "", "", "")
endif
}
by the way, its 2am so if what I am trying to get at isn't entirely clear, you know why.
Do you have them programmed into a button? I would probably put it in a button so that it only looks at the obsvalue at that point in time and won't run again if the value changes. You can add a popup option if the order was already added, or if any of them were added. Maybe this:
cond
case obsany("SMOK STATUS") == "current every day smoker" if match(ORDER_LIST_CHANGES(),"tobacco")>0 then if useryesno("Tobacco screen service already added. Add again?") == "Yes" then MEL_ADD_ORDER(“S”, “Office Services”, “SM – screened for tobacco use and received tobacco cessation intervention”, “”, “”, “”, “”, “”, “”, “”, “”) else "" endif else MEL_ADD_ORDER(“S”, “Office Services”, “SM – screened for tobacco use and received tobacco cessation intervention”, “”, “”, “”, “”, “”, “”, “”, “”) endif
case obsany("SMOK STATUS") == "current some day smoker" if match(ORDER_LIST_CHANGES(),"tobacco")>0 then if useryesno("Tobacco screen service already added. Add again?") == "Yes" then MEL_ADD_ORDER(“S”, “Office Services”, “SM – screened for tobacco use and received tobacco cessation intervention”, “”, “”, “”, “”, “”, “”, “”, “”) else "" endif else MEL_ADD_ORDER(“S”, “Office Services”, “SM – screened for tobacco use and received tobacco cessation intervention”, “”, “”, “”, “”, “”, “”, “”, “”) endif
endcond
(and add a case for the other order options in there).
thank you! I was trying to add it to the function which was giving me the issue. I guess a button is really the safest way to go. I am going to play with the code you gave me though. See what happens.