I have a handout that pulls in labs but I only want 3 days to pull in and if they have not had any labs in the past 3 days then I do not want any labs to pull in. It is pulling in the labs but it is pulling in labs back to 2009. Here is the formula can someone take a look and see what I have wrong in it please. Thanks in advance.
{labs = GET_FLOWSHEET_VALUES('Enterprise\Printing\Chart_Summary\Current-Labs')
if labs <> "" then
lablist = getfield(labs, "\n", "")
sz = size(lablist)
list = ""
for i = 1, i <= sz, i = i + 1 do
dt = ""
tody = str(._todaysdate)
lab = lablist[i]
if size(lab) > 0 then
dtbegin = match( lab,"
(") +1
dt = sub(lab, dtbegin, 10)
dur = durationdays(dt, tody)
if dur < 4 then
list = list + lab + "\n\r"
else
list = list
endif
else
list = list
endif
endfor
if list <> "" then list else "No lab results." endif
else
"No lab results."
endif}
Known SPR - Broken
Try this:
{list = ""
labs = GET_FLOWSHEET_VALUES('Enterprise\Printing\Chart_Summary\Current-Labs')
if labs <> "" then
lablist = getfield(labs, "\n", "\r")
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, "(") + 1
dt = sub(lab, dtbegin, 10)
dur = durationdays(dt, tody)
if dur < 3 then
list = list + lab + "\n\r"
endif
endif
endfor
endif
if list <> "" then
list
else
"No lab results."
endif}