I am working on brining in the last 3 months of lab results into an office visit I just need to have it so it will have comma's after each result, right now it is coming up in individual rows. This is what I have. Thanks in advanced for your help.
{labs = GET_FLOWSHEET_VALUES('Enterprise\Printing\Chart_Summary\Current-Labs')
tody = str(._todaysdate)
if labs "" then
lablist = getfield(labs, "\n", "")
sz = size(lablist)
list = ""
for i = 1, i 0 then
dtloop = 0
dtptr = 1
while (dtloop = 0) and (dtptr + 11 <= labsize)
do
dtbegin = match( lab, dtptr,"/") -2
dt = sub(lab, dtbegin, 10)
if sub(lab, dtbegin + 10, 1) = ")" then dtloop = 1 endif
dtptr = dtbegin + 3
endwhile
dur = durationdays(dt, tody)
if (dur < 4) and (dtloop = 1) then
list = list + lablist[i] + "\n\r"
endif
endif
endfor
if list "" then list else "No lab results." endif
else
"No lab results."
endif}
Should just have to change this piece of the code:
list = list + lablist[i] + "\n\r"
to
list = list + lablist[i] + ", "
Perfect, thanks so much
I tried to just copy this into a text component, and changed the flowsheet to one we use.
However, I get an error when I add the text component to an Update.
endif <-COMPILER ERROR NEARBY: Expect EXPRESSION. Instead had NON-TERMINATED STRING after LEFT PAREN
Try this and let me know if that does the trick. Good Luck...
{labs = GET_FLOWSHEET_VALUES('Enterprise\Printing\Chart_Summary\Current-Labs')
tody = str(._todaysdate)
if labs "" then
lablist = getfield(labs, "\n", "")
sz = size(lablist)
list = ""
for i = 1, i 0 then
dtloop = 0
dtptr = 1
while (dtloop = 0) and (dtptr + 11 <= labsize)
do
dtbegin = match( lab, dtptr,"/") -2
dt = sub(lab, dtbegin, 10)
if sub(lab, dtbegin + 10, 1) = ")" then dtloop = 1 endif
dtptr = dtbegin + 3
endwhile
dur = durationdays(dt, tody)
if (dur < 4) and (dtloop = 1) then
list = list + lablist[i] + ", "
endif
endif
endfor
if list "" then list else "No lab results." endif
else
"No lab results."
endif}
Get the same cryptic error in MEL.
How are you using this? Does it exist as a text component that you add into an encounter?
I have it set up as a text component for them to bring in from their favorites.
I wonder if something got lost as you cut/pasted?
Line 3 looks odd:
if labs “” then
Shouldn't there be an = in there?
Line 7, your for statement seems missing something
for i = 1, i 0 then
There were some issues with the copy/past, so I will re-post what worked for me to grab labs from the past 14 days. I pasted this into a text component, as it was way more than the 500 character QuickText limit. Although you could do a quicktet to automatically import this. Proabably a better application might be within a screen form to remind a physician of recent lab results during an office visit. Notes on areas that may need to be adjusted:
1) The 14 is near the bottom of the script.
2) Adjust the first variable to point to a flowsheet view you want to use. You will only see results that are included in this view of OBS Names.
{Thanks to Beth for the code.}
{labs = GET_FLOWSHEET_VALUES("Enterprise\NEMC\GM Flowsheet\ENDO DM labs")
tody = str(._todaysdate)
if labs <> "" then
lablist = getfield(labs, "\n", "")
sz = size(lablist)
list = ""
for i = 1, i <= sz, i = i + 1 do
dt = ""
lab = lablist[i]
labsize = size(lab)
if labsize > 0 then
dtloop = 0
dtptr = 1
while (dtloop = 0) and (dtptr + 11 <= labsize)
do
dtbegin = match( lab, dtptr,"/") -2
dt = sub(lab, dtbegin, 10)
if sub(lab, dtbegin + 10, 1) = ")" then dtloop = 1 endif
dtptr = dtbegin + 3
endwhile
dur = durationdays(dt, tody)
if (dur < 14) and (dtloop = 1) then
list = list + lablist[i] + ", "
endif
endif
endfor
if list <> "" then list else "No lab results." endif
else
"No lab results."
endif}
This seemed to work for one day but now it is not pulling in the last 3 months of lab results if anyone is able to assist, I appreciate it.
{labs = GET_FLOWSHEET_VALUES('Enterprise\Printing\Chart_Summary\Current-Labs')
tody = str(._todaysdate)
if labs "" then
lablist = getfield(labs, "\n", "")
sz = size(lablist)
list = ""
for i = 1, i 0 then
dtloop = 0
dtptr = 1
while (dtloop = 0) and (dtptr + 11 <= labsize)
do
dtbegin = match( lab, dtptr,"/") -2
dt = sub(lab, dtbegin, 10)
if sub(lab, dtbegin + 10, 1) = ")" then dtloop = 1 endif
dtptr = dtbegin + 3
endwhile
dur = durationdays(dt, tody)
if (dur < 4) and (dtloop = 1) then
list = list + lablist[i] + ", "
endif
endif
endfor
if list "" then list else "No lab results." endif
else
"No lab results."
endif}
Below is lab results the patient had in the past 3 months Thanks so much to Joeg1962
{labs = GET_FLOWSHEET_VALUES('Enterprise\Printing\Chart_Summary\Current-Labs')
tody = str(._todaysdate)
if labs "" then
lablist = getfield(labs, "\n", "")
sz = size(lablist)
list = ""
for i = 1, i 0 then
dtloop = 0
dtptr = 1
while (dtloop = 0) and (dtptr + 11 <= labsize)
do
dtbegin = match( lab, dtptr,"/") -2
dt = sub(lab, dtbegin, 10)
if sub(lab, dtbegin + 10, 1) = ")" then dtloop = 1 endif
dtptr = dtbegin + 3
endwhile
dur = durationdays(dt, tody)
if (dur < 91) and (dtloop = 1) then
list = list + lablist[i] + ", "
endif
endif
endfor
if list "" then list else "No lab results." endif
else
"No lab results."
endif}
Hello,
I am working on populating the last 7 days of lab results within a handout. Very similiar idea, but for some reason the code doesn't seem to work in handouts when I add it in. I also tried adding the code as a text component and adding the component into the handout but I get the following errors
"{INSERT_TEXT_COMP(Enterprise\TestMU2 <- COMPILER ERROR NEARBY: Expect COMMA OR RIGHT PARETHESIS. Instead had INDENTIFIER after INDENTIFIER
This was how I inserted the code into the handout:
{INSERT_TEXT_COMP(Enterprise\TestMU2)}
Thanks in advance!