Im sorry, I will take a look at it but it works for me,not exactly as I want it to, but with no errors.
No worries. I appreciate what you have done so far. I need to learn this so I don't need so much help. Again, thank you!
you don't want the function itself in the data display, just the call to it.
I thought I had done that, can you point out my error please? I would appreciate it.
This is all that you would have in your data display
{fnLast3DaysLabs()}
All your other code (the function itself) would be in the Watcher pane.
Ok, thanks!
Thank you!!!!!! That worked.
Great! Just make sure everywhere you have "No Lab Results" you have it preceded by a
list=
But I still cannot get it to work for the 3 days!!!
Try this:
{fn fnLast3DaysLabs()
{
local list
local labs
local lablist
local sz
local tody
local i
local dt
local dtbegin
local dur
list = ""
labs = GET_FLOWSHEET_VALUES("Enterprise\Printing\Chart_Summary\Current-Labs")
if labs <> "" then
lablist = getfield(labs, "\n", "")
sz = size(lablist)
tody = str(._todaysdate)
for i = 1, i <= sz, i = i + 1 do
lab = lablist[i]
if size(lab) > 0 then
dtbegin = match(lab, "/") - 2
dt = sub(lab, dtbegin, 10)
dur = durationdays(dt, tody)
if dur < 4 then
list = list + lab + "\n\r"
endif
endif
endfor
if list == "" then
list = "No lab results."
endif
else
list = "No lab results."
endif
return list
}
}
It doesnt work when there is more than the number value in the field. For example: If there is "142 MEQ/L" it will not work, but if it is just "14" it works fine!
The line
dtbegin = match(lab, "/") – 2
May need to be
dtbegin = match(lab, "/2013") – 5
I'm guessing on the 5...