I'm also working on the Patient Instructions handout.
In my case, providers will enter clinical data while the patient is in the office, and then place that document on 'Hold.' While the document is on 'Hold,' we will print a handout, and the provider will sign off on the document some amount of time later.
My issue is that OBSNOW() returns "" inside the handout while the document is on hold, and OBSANY() returns the value entered during the previous update. OBSANY() does NOT return the value entered during the update that was placed on 'Hold.'
The help topic defines the return value for OBSANY() as:
"the most recent observation value up to and including the current update."
Am I correct in saying that updates placed on 'Hold' are not defined as being 'the current update,' and that OBSANY() will not return the value for an obs term entered before placing the update on 'Hold' ? Or, is there some issue with OBSANY() that only I am experiencing?
That is correct, OBSANY will only evaluate signed documents and active chart updates.
This was a problem for us as well, so i created a function that would look up observations in the pencil status regardless of whether the document was active. It first checks the object "_PencilOnlyObs" then if it does not find a result looks in "SignedObs" and filters all results by date. It took me a bit to get it setup and we use it mostly for the CVS, if it is something you might be interested in send me an email and I can send some examples of what I did.
Mike
I am experiencing this problem with obsnow with one obs term but not with any other, and I think it's a bug. obsnow should be the current value in the update regardless if it was assigned prior to putting the document on hold or not. Here is my code:
if obsnow("HPV VAX DOSE")<>"" then
if (obsnow("HPV VAX VIS")=="") then
obsnow("HPV VAX VIS","05/17/2013")
endif
if obsnow("HPV#1AD")=="" then
obsnow("HPV#1AD",sub(str(document.clinicaldate),1,10))
endif
endif
When I first enter a value in the form for HPV VAX DOSE, it assigns 05/17/2013 to HPV VAX VIS and the document date for HPV#1AD. I change each of those dates. I then put the document on hold and view clinical list changes. Everything looks fine. Then I edit the document and see that, while HPV VAX DOSE still has the value I changed it to, HPV#1AD has been updated to the document date again. Any explanation or qworkaround would be appreciated!
Ken
OBSANY will return a value, but you have to be in the chart, not necessarily the update, to get the value from the update that's on hold.
I don't want to use obsany. I don't care what its value was prior to this update, only what it is during the update, and I don't care whether the value was set prior to going on hold or not.
Both HPV VAX DOSE and HPV VAX VIS retain the obsnow values from prior to going on hold, so I can't see a logical reason why the same is not the case for HPV#1AD, unless it is somehow executing this code prior to reloading the value of HPV#1AD. By the way, iof I do use if obsany("HPV#1AD")=="" then, the condition still evaluates to true and the date gets replaced by the current date. This at least seems consistent to me, albeit consistently wrong
It is my experience that loading the observations tied to a document is one of the last things it does. It is quite plausible that it just hasnt loaded it before the code is executed. I have moved away from using observations for checking conditions for this reason. Almost all of my code and form fields use document variables, and then I save obsterms separately in the watcher pane with code like {OBSNOW("HEIGHT",document.height)}. You could also prevent the problem above by adding a document variable to check if the code had been executed already, like below, then it shouldn't overwrite your changes on form open.
if obsnow("HPV VAX DOSE")<>"" then
if document.execute == "" then
if (obsnow("HPV VAX VIS")=="") then
obsnow("HPV VAX VIS","05/17/2013")
endif
if obsnow("HPV#1AD")=="" then
obsnow("HPV#1AD",sub(str(document.clinicaldate),1,10))
endif
document.execute = "Done"
endif
endif
Thanks Michael, that's helpful, if not exactly the logic I want.
What's maddening is that it appears to have loaded the values for other obs terms on which the code that it wrongly executes is dependent. If it loaded them all at the beginning or end there wouldn't be this problem. It makes me wonder where else this issue may be lurking.
Thanks again
Ken