Good morning, just noticed that a handout that the L&D dept use has some fields that are no longer working. For example: {mobsval("CHLAMYD DNA ","CHLAMYDIA AB ",”CHLAMTRNATNA”)} and {mobsdate("CHLAMYD DNA “,"CHLAMYDIA AB ",”CHLAMTRNATNA”)}
It is returning "function definition is not executable". Did GE do away with these symbols? If so, what is an easy way to be able to pull in a value from the possibility of 2 or more obsterms?
Any suggestions?
Thanks,
Linda
I have never heard of mobsval. Does it only return the latest value, or all of the observations that have any value.
I wrote a function myself to get the latest value from a pair of obs terms, because our lab sometimes sends data to the wrong one. I am pretty sure it could be extended to include multiple values. let me know what the expected return value is and I can get back to you.
Thank you,
Daniel
What it needs to do is pull in the result and the date of the result if the obsterm was one of those obsterms. I think the reason is because of how tests were ordered it could be a different obsterm that the result would be saved to and regardless, the result needed to be included on this handout. I have several fields like this, one for GC, HIV and Rubella titer as well.
Thanks!
Looks like a custom function name. 'm' most likely meaning 'multiple'. Might want to examine the source of the function to find the definition.
That's what it was! Thanks Lee. Apparently someone copied a portion of the OB Summary report and created a OB Lab Test Results handout, but didn't copy the function section! I happen to pull the one that had been copied so that was why it didn't work. Duh!
I'm glad you found it. I built a custom function myself anyways that will find the latest OBS term out of a list of possible obs names, and return the latest name so you can use it with the standard GE Mel code such as OBSPREV and LAST_SIGNED_OBS_DATE to get the same information. it was good practice on using getnargs and getarg for functions with unknown amounts of input. I'll post it here anyways because why not. 🙂
{fn GetLatestOb(){
local count = getnargs()
if (count > 1) then
local newest = getarg(1)
for c=2, c <= count, c=c+1 do
local Obs2 = getarg(c)
local diffVar = DURATIONDAYS(LAST_SIGNED_OBS_DATE(newest),LAST_SIGNED_OBS_DATE(Obs2))
if (OBSPREV(newest) <> "" and OBSPREV(Obs2) <> "") then
if (diffVar >=0) then
newest = Obs2
endif
else if (OBSPREV(newest) <> "" AND OBSPREV(Obs2) == "") then
newest = newest
else if (OBSPREV(newest) == "" AND OBSPREV(Obs2) <> "") then
newest = Obs2
else
newest = ""
endif endif endif
endfor
return newest
else if (count==1) then
return getarg(1)
else if (count <1) then
return ""
else
return ""
endif endif endif
}}
an example of this function being called would look like this:
GetLatestOb("HDL","LDL","HGBA1C","UA DRUG")
if the Drug screen was done yesterday, and the other labs were done a week ago, the function will return "UA DRUG". You can use as many or as few Obs as you like, and the latest will always be the one returned. I use it in my forms to check on labs that sometimes get put in the wrong Obs terms like so:
Diabetic Eye Exam: OBSPREV(GetLatestOb("DM EYE EXAM,EYE EXAM, DIABEYECHK")).
If a patient has none of the above obs terms filled, it returns a blank.
Thanks for letting me share, and have a great holiday everybody!
Thanks for the work on the function you built. It may come in handy for something else.