Can someone help me fix this? If I ask it to return alls[1][1] it only returns the first allergy in the list. All I want it to do is return all the allergies using this or a similar function. I am trying to format the output to something more aesthetically functional than pipes and carrots. Thanks so much.
CHUG is such a great resource!
{
global list = ""
global alls = getfield(ALL_AFTER("delimited"),"|","")
for i=1, i<=size(alls), i=i+1
do
alls[i] = getfield(alls[i],"^","")
endfor
if alls <> "" then
list = list + hret
else list = "No Known Allergies"
endif
list = alls[1] + ", " + alls[2] + hret
}
{
global list = ""
global alls = getfield(ALL_AFTER("delimited"),"|","")
global alls2 = array
if alls <> "" then
for i=1, i<=size(alls), i=i+1 do
alls2 = getfield(alls[i],"^","")
list = list + alls2[1] + ", " + alls2[2] + hret
endfor
else
list = "No Known Allergies"
endif
}
Thank you!!!
I had to add "list" at the end of the function to return values, otherwise it only returns "FALSE". Which surprises me. I would expect to see "TRUE". At any rate, this is exactly what I need. Now I will assign the proper field number to the "list" and pull the allergy comment field into a handout or letter.
This is is really great. Thank you!
{
global list = ""
global alls = getfield(ALL_AFTER("delimited"),"|","")
global alls2 = array
if alls <> "" then
for i=1, i<=size(alls), i=i+1 do
alls2 = getfield(alls[i],"^","")
list = list + alls2[1] + ", " + alls2[2] + hret
endfor
else
list = "No Known Allergies"
endif
list
}