I'm looking to use an action button to move a value from one obsterm to another. This is to track current goals versus met goals. Once a goal has been met, the user will select the goal from the data display's dynamic list and then click the action button to save that obsterm goal as a new obsterm met goal and then clear the original goal.
{!fn GoalMet(){
if match(DOCUMENT.CURRENTGOALS,1,OBSANY("GOAL1"))>0 and ("GOAL1") <> "" then
OBSNOW("GOAL1MET",str(._TODAYSDATE)+": "+OBSNOW("GOAL1")) AND OBSNOW("GOAL1",DOCUMENT.EMPTY)
else ""
endif
}}
The action button just has {GoalMet()}
I can't figure out what I'm missing to make it work. Thanks!
noticed you are missing OBSPREV, OBSNOW or OBSANY on this…
("GOAL1") <> ""
Also, this line does not seem right
OBSNOW("GOAL1MET",str(._TODAYSDATE)+": "+OBSNOW("GOAL1")) AND OBSNOW("GOAL1",DOCUMENT.EMPTY)
I think you wanted:
OBSNOW("GOAL1MET",str(._TODAYSDATE)+": "+OBSNOW("GOAL1"))
OBSNOW("GOAL1",DOCUMENT.EMPTY)
I do not know if you can actually "enter" an "" (empty) into an obsterm to "clear" it and have it SAVE as empty.
You are just clearing OBSNOW(xxx) during the current encounter.
After signing the encounter, during the next visit for this patient,
I think OBSANY(xxx) will just default to the previous obsterm xxx with a value in it.
You might have to instead make DOCUMENT.EMPTY = "." or 0 so you can check for "." or 0
- Beverly
That was actually an error on my part when retyping it here. I currently have an OBSANY("GOAL1") <> "".
I'm not necessarily looking to clear the obsterm altogether, just to have it come up the next visit as blank, which is why I pushed DOCUMENT.EMPTY to the term because it is a hidden edit field that remains blank. I hope to just override the previous value with the blank so at the next visit it won't come up with any value.
Even when I remove the latter portion of trying to clear the first obsterm, I still can't get the goals met obsterm to populate with OBSNOW("GOAL1MET",str(._TODAYSDATE)+": "+OBSNOW("GOAL1")).
This is the part that I think will not work (saving "" into an obsterm).
I hope to just override the previous value with the blank so at the next visit it won't come up with any value.
Will this work for you ? I haven't tested it...
{!fn GoalMet(){
local thisGoal = OBSANY("GOAL1")
if (thisGoal<>"" AND thisGoal<> "0") then
if match(DOCUMENT.CURRENTGOALS,1,thisGoal)>0 then
OBSNOW("GOAL1MET",str(._TODAYSDATE)+": "+ thisGoal )
OBSNOW("GOAL1","0")
else "" endif
else "" endif
}}
- Beverly
Yes! I got it work!
Thanks!