Hello everyone,
I am trying to write a function that would allow me to display all of the patients future scheduled appointments at a specific location of care. Here is what I am working with currently if anyone could help me out:
{fn nextappointment(loc){
apptarray = getfield(appts_by_status("Scheduled","FULL"),"\r","")
count
datearray
result = ""
for count = 1, count <= size(apptarray), count = count + 1
do datearray = getfield(apptarray[count],",","")
if match(datearray[4],loc) > 0 then result = result + "Your next appointment is on " + datearray[1] + " at " + datearray[2] + "\r"
else ""
endif
endfor
result
}
The interesting thing here is that if I use ANY instance of datearray aside from datearray[1] ANYWHERE in the function, it does not work. I want the output to basically look like this:
"Your next appointment is on mm/dd/yyyy at 12:00a"
and i would like to be able to specify the results based on the location of care. Any help would be greatly appreciated