I have a provider interested in creating a QT that will pull in the last three values for an observations. For example, "Patients last three INR values were .....". I thought we might have to limit this to a time frame such as last 30 days rather than last three values.
I have not been successful in my attemps to create anything using data symbols. Thanks for any advise or help!
May have to store in text component or mellib.txt and call it from quicktext.
{fn Last3ObsValues(obs)
{
local obslist = LIST_OBS(obs, "SIGNED", "COMMA", "VALUEDATE")
if size(obslist)==0 then
return ""
else
local myarray = getfield(obslist, ",", "^")
if myarray[1]<>"" then
if myarray[2]<>"" then
if myarray[3]<>"" then
return myarray[1] + hret + myarray[2] + hret + myarray[3]
else
return myarray[1] + hret + myarray[2]
endif
else
return myarray[1]
endif
else
return ""
endif
endif
}
}
Thanks for your quick response! I am not experienced with much MEL other than simple projects. However, I did create a text component using your example. I believe I am missing something as I cannot get txt component to work. I replaced your 'obs' with the observation term I want to use however I get an error. I believe I am interpretting the variable in this function incorrectly. As you can tell, I have never created a function, lol!
{fn Last3ObsValues("PT PATIENT")
{
local obslist = LIST_OBS("PT PATIENT", "SIGNED", "COMMA", "VALUEDATE")
if size(obslist)==0 then
return ""
else
create the function in a text component and add it to your update:
{fn Last3ObsValues(obs)
{
local obslist = LIST_OBS(obs, "SIGNED", "COMMA", "VALUEDATE")
if size(obslist)==0 then
return ""
else
local myarray = getfield(obslist, ",", "^")
if myarray[1]<>"" then
if myarray[2]<>"" then
if myarray[3]<>"" then
return myarray[1] + hret + myarray[2] + hret + myarray[3]
else
return myarray[1] + hret + myarray[2]
endif
else
return myarray[1]
endif
else
return ""
endif
endif
}
}
call the function from the quicktext:
{Last3ObsValues("PT PATIENT")}
I created the function in a text component and understand how to call it using the QT. However, I am missing how to add the function to the update since I am not creating it in a form. I may not be explaining this well!
I appreciate your help, thanks.
Just add the text component to the document templates that you want to be able to use the quick from. Or add it from within a form when the form loads.
Works great! I am a nurse but quickly learning more of the language and this finally clicked. Thanks so much for your time and help.