does anyone know how the syntax looks, to use the SUM_ACTIVE_OBSERVATIONS function? EMR Help has no example specific to SUM_ACTIVE_OBSERVATIONS ...
just trying to show the latest immunizations, from a flowsheet, in a chart summary print out.
thanks
-richard
That is not really a function, it is a connection type for a flowsheet view used to display parts of the flowsheet in a form. If you want to list immunizations in a handout or letter you probably want to write a function using GET_FLOWSHEET_VALUES() which will return all results from a specified flowsheet view.
Well right now we have a letter with
{(GET_FLOWSHEET_VALUES("Enterprise\Printing\Chart_Summary\Immunizations")}
And it pulls all the values from the flow sheet quite nicely. But the head doctor only wants it to pull the most recent Immunizations entered in that flowsheet.
Do you have a function you could share? I'm pretty lost at this point.
Try this, it should get the most recent by date regardless of when they were entered. I didnt test it a lot but it appeared to work on one of my flowsheet views
{fn GetLastFlowsheetValue(path){
local hold = getfield(GET_FLOWSHEET_VALUES(path,"DELIM"),"|","")
local rslt = array()
local temp = array()
local temp2 = array()
local there = ""
for i = 1,i <= size(hold),i = i + 1 do
if hold[i] <> "" then
temp = getfield(hold[i],"^","")
for j = 1, j <= size(rslt), j = j + 1 do
temp2 = getfield(rslt[j],"^","")
if temp[1] == temp2[1] then
if durationdays(temp2[3],temp[3])>0 then
set(rslt,j,hold[i])
endif
there = "Y"
endif
endfor
if there == "" then insert(rslt,size(rslt) + 1,hold[i]) else there = "" endif
endif
endfor
for i = 1, i <= size(rslt), i = i + 1 do
temp = getfield(rslt[i],"^","")
if rtnstr <> "" then
rtnstr = rtnstr + hret
endif
rtnstr = rtnstr + temp[1] + ": " + temp[2] + " (" + temp[3] + ")"
endfor
return rtnstr
}}{GetLastFlowsheetValue("Enterprise\Printing\Chart_Summary\Immunizations")}
I can't tell you if this code works right or not. Something is wrong with my versions of word or notepad or both. The RTF I am trying to edit took a few previous edits from monday and tuesday, but now -any changes made- even if I know the code is correct, the results make no sense. It is as if there is some sort of residue of previous versions of the code hidden in my files.
For example, if use the above code and view the print out for Test Patient_01 a list of immunizations are pulled. If I print it again the same list is pulled, but more than once. If I print it from another patient's chart Test Patient_02 the same list is pulled 2 – 3x mixed with both patient's results. If i delete the code and re-enter something simple like:
{GET_FLOWSHEET_VALUES("EnterprisePrintingChart_SummaryImmunizations", "List")}
then the results of the previous function are displayed along with the new function's results… and never mind if I switch patient's, it's a mess.
No mel vomit. just results that don't seem to follow logic.
When I revert back to use the original RTF document, all is good and fields print accordingly. But as soon as I edit it, weird things start to happen…
Does that ring a bell? Has anyone encountered this problem when trying to print a custom letter?
Maybe rtnstr is a global variable for you, i see i didnt declare it either, i would change that to something else and declare it at the top. Like
local retnstr = ""
… (same thing here)
for i = 1, i <= size(rslt), i = i + 1 do
temp = getfield(rslt[i],"^","")
if retnstr <> "" then
retnstr = retnstr + hret
endif
retnstr = retnstr + temp[1] + ": " + temp[2] + " (" + temp[3] + ")"
endfor
return retnstr
As for the copying and pasting, it is always recommended that any code you take from this website, or generally any other source, that you should paste into notepad first, recopy from there, and paste into a centricity or vfe code window. WordPad works too but i would only use it for handout and letter code where you want additional formatting
I am editing (trying to) the chartsum.rtf (chart summary) located in local program files>centricity 9.5...
I wasn't building any code in word, just copying and pasting it to the RTF document from notepad and saving as RTF. The only things that are built in word, it seems, are the tables... Anyways, the problem seems to have been - working with word, not wordpad. Even though both are copied from notepad saved as RTF the document has to be saved from wordpad, at least with microsoft office 2003. Thank you for the suggestions, again.
The function still may or may not be working correctly. The flowsheet we are pulling from has serious issues that need to be fixed (mislabeled observations, multiple entries of the "same" vaccine etc...) however, what continues to occur is Test Patient_01's vaccines are showing up on Test Patient_02's results. No other fields seem to be repeating elsewhere...