Hello,
I am attempting to get lab results in a form with the following code and am receiving "COMPILER ERROR NEARBY: Expect RIGHT SQUARE BRACKET. Instead had EOF after identifier".
{ 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,
"/") -2
dt = sub(lab, dtbegin, 10)
dur = durationdays(dt, tody)
if dur < 4045 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 }
Does anyone have any idea where the error is? Any assistance would be greatly appreciated.
Thanks.
I would start by switching the backslashes in the first line to forwardslashes ('/'). The backslash is used by Centricity to indicate a special character is coming next, and it will ignore the backslash and in some cases replace the next character.
Thank you. Now I get "COMPILER ERROR NEARBY: Expect COMMA OR RIGHT PARENTHESIS. Instead had STRING after STRING".
My code now looks like:
{ 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,
"/") -2
dt = sub(lab, dtbegin, 10)
dur = durationdays(dt, tody)
if dur < 4045 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}
Thanks
Sorry, i was confusing, you dont need the extra quotations, like this -
labs = GET_FLOWSHEET_VALUES('Enterprise/Printing/Chart_Summary/Current-Labs')
After replacing my first line with yours, I receive the following error:
COMPILER ERROR NEARBY: Expect RIGHT SQUARE BRACKET. Instead had EOF after IDENTIFIER
Thanks
Did you copy and paste into notepad or wordpad first, and then copy into Centricty? This additional step is necessary to remove hidden formatting. If you are copying into VFE then this step isnt necessary. Let me know if that does not solve it
Just in case, I copied the code into notepad and then into the VFE form and this did not resolve the issue.
Same error.
Thanks
I just copied it into a text componenet and got it to work using one of my flowsheet views with the below code (I switched the flowsheet name back to yours), its a bit different but with your path it should work (fingers crossed)
{labs = GET_FLOWSHEET_VALUES(''Enterprise\Printing\Chart_Summary\Current-Labs','DELIM')
if labs <> "" then
lablist = getfield(labs,"|", "")
list = ""
for lCount = 1, lCount < size(lablist), lCount = lCount + 1 do
sublablist = getfield(lablist[lCount],"^","")
if size(sublablist[2]) > 0 then
dur = durationdays(sublablist[3], str(._todaysdate))
if dur < 4045 then
list = list + sublablist[1] + ": " + sublablist[2] + hret
endif
endif
endfor
if list <> "" then list else "No lab results." endif
else
"No lab results."
endif}
I kept getting a bad index error which I resolved by switching <= in the for statement to a <, that may have been the key the whole time
I do not receive an error anymore but, it does not pull in the labs. 🙁
I am testing the form on a person that has had labs done.
Thanks
Ugh... The labs have to be signed to show up with this function.... could that be it? Does it say No Lab Results or is it just blank? Im running out of ideas, at this point I would say run a mel trace and see if there are any errors in there, also what version of Centricity are you on?
No worries. I appreciate what you done for me anyways. I am on version 9.5. I do not get anything (No "No Lab Results"). I will run the mel trace and let you know what happens. Thank you.
change:
labs = GET_FLOWSHEET_VALUES(''Enterprise\Printing\Chart_Summary\Current-Labs','DELIM')
to:
labs = GET_FLOWSHEET_VALUES("Enterprise\Printing\Chart_Summary\Current-Labs","DELIM")
I believe you can use either single quotes or double quotes, but you must be consistent. I usually use double quotes, but you were using a combination of both.
In MEL, there is no 0th element like all other programming languages on the planet have. This is why for-loops start with element 1, and this means that you must loop until index<=size(list) not until index<size(list). If you leave out the '=', then your loop may not ever look at the last value in the list.
Someone can most likely help you better if you describe more precisely what you're trying to do. You stated that you were "trying to get lab results into a form."