Does anyone know why this would not show the last HEMOCCULT 1 obs value/date in the note when the HEMOCCULT 1 obs term is updated within the update? Nothing happens.
This is in the Data Display translation tab under chart note:
{if obsnow('HEMOCCULT 1')<>"" then cfmt(obsany('HEMOCCULT 1')+" ("+lastobsdate('HEMOCCULT 1')+")","","Hemoccult 1: ","B","
") else "" endif}
{if obsnow('HEMOCCULT 1')<>"" then cfmt(obsany('HEMOCCULT 1'),"","Hemoccult 1: ","B"," ("+lastobsdate('HEMOCCULT 1')+")
") else "" endif}
or just
LASTOBSVALUEDATE("HEMOCCULT 1")
if there is not a new one it should display last one (i think)
the main issue was the format of the CFMT statement, but yes you could use
{cfmt(LASTOBSVALUEDATE("HEMOCCULT 1"),"","Hemoccult 1: ","B","
")}
If I use LASTOBSVALUEDATE then old values comes in though, the providers only want this to come in if it is updated in this update (sometimes backdated). I tried using just plain OBSNOW but it doesn't work for some reason, maybe because it is being populated in a different way, like you see below. I tried the first suggestion too but nothing happens with that either, maybe for the same reason?
{fn hem(slOT,slVal,slObsDate){
if slOT=="" or slVal=="" or slObsDate=="" then
return ""
endif
if toupper(useryesno("Observation: "+slOT+" Value: "+slVal+" Date: "+slObsDate+" Enter this in the database?"))==toupper("Yes") then
if (val(durationdays(slObsDate,sub(str(document.clinicaldate),1,10))) < 0) then
userok("The date is not valid.")
return ""
endif
obsnow(slOT,slval,slObsDate)
endif}
{if hem('HEMOCCULT 1',DOCUMENT.HEM1,DOCUMENT.DATE1)<>"" then
DOCUMENT.HEM1=""
DOCUMENT.DATE1=""
else
""
endif
}
The hem function does work though because the flowsheets are always updated.
Actually this made me think and now I see that OBSNOW refers to today's date, not for today's update (the description is misleading in the Using Data Symbols manual). If anyone has any ideas on how I could show just what is in the update (even if it is backdated), please let me know.
OBSNOW() is for the active update only, it will show only the most recent observation made in the open document.
OBSANY() is for active update and previously signed updates, it will show the most recently dated value
OBSPREV() is for previously observations from outside of the update, and already signed. Although I much prefer LAST_SIGNED_OBS_VALUE(), it seems to work much better for loading observations on form open.
Sounds like OBSNOW() is the way you want to go....
Thanks everyone for trying to help. Unfortunately OBSNOW has this documented in the comments so it won't work, I had never noticed this before:
OBSNOW only returns a value when the observation date matches the
clinical date of the document.
Huh, didn't know that, learn something new everyday!
Try - LIST_OBS('HEMOCCULT 1','Update','VALUEDATE','LIST')
Good idea, I forgot about that. I am getting closer, that worked, like this
{LIST_OBS('HEMOCCULT 1','update','list',"valuedate")}
But only if I put the update on hold and go back in...
So I tried adding the exclamation point but that didn't help. Then I tried adding this to the code panel- {hem1.temp = LIST_OBS('HEMOCCULT 1','update','list',"valuedate")} and this to chart note section{CFMT(hem1.temp,"","Hemoccult 1: ","","
")}
but that didn't help either.
Do you use that function for anything else? If not you could try adding this
hem1.temp = LIST_OBS('HEMOCCULT 1','update','list',"valuedate")
to the function right after
obsnow(slOT,slval,slObsDate)
If you do use it for something else you could return the LIST_OBS() part and set hem1.temp to hem() in the second part of the code. I would also use a document variable instead of a global, but it will work either way
I tried it and it seems like it should work but it doesn't do anything, not even when I put the update on hold like it did before.
And I meant to say that function isn't used for anything else. I am going to add hemoccult 2 and 3 later on.
Like this and it doesn't work with document.hem1_temp in the data display?
{fn hem(slOT,slVal,slObsDate){
if slOT=="" or slVal=="" or slObsDate=="" then
return ""
endif
if toupper(useryesno("Observation: "+slOT+" Value: "+slVal+" Date: "+slObsDate+" Enter this in the database?"))==toupper("Yes") then
if (val(durationdays(slObsDate,sub(str(document.clinicaldate),1,10))) < 0) then
userok("The date is not valid.")
return ""
endif
obsnow(slOT,slval,slObsDate)
document.hem1_temp = LIST_OBS('HEMOCCULT 1','update','list',"valuedate")
endif}
{if hem('HEMOCCULT 1',DOCUMENT.HEM1,DOCUMENT.DATE1)<>"" then
DOCUMENT.HEM1=""
DOCUMENT.DATE1=""
else
""
endif
}
{!document.hem1_temp}