I am on CPS 12.0.13. I am looking for a formula that I can put in a letter that will pull all future scheduled appointments for a patient.
Does anyone have anything like that or have suggestions?
Thank You
TM
Try using the function:
APPTS_BY_STATUS(status,[FULL]) where status can be "scheduled", "no show", "canceled", "arrived". If there is too much information, remove the "FULL"
Example: APPTS_BY_STATUS("scheduled", "FULL") will show all scheduled appointments.
That is what we use as well and it works great although sometimes it will show past appointments for some reason regardless of the appointment status.
I have used something like this:
{global alist = getfield(APPTS_BY_STATUS("scheduled","FULL"),"\r","")
global asz = size(alist)
global tempa
global rslt=""
for count = 1, count < asz, count = count + 1
do
tempa = getfield(alist[count],",","")
days = DURATIONDAYS(str(._TODAYSDATE),tempa[1])
if days>0 then
rslt = rslt + tempa[1] + " at" + tempa[2] + " Type:" + tempa[3] + " with" + tempa[5]
else "" endif
endfor
rslt
}
which creates:
10/18/2018 at 10:00 AM Type: EF with Doctor X
04/04/2019 at 10:00 AM Type: PE with Doctor Y
By the way, my coding does a date check to only get future appointments. I too sometimes saw past appointments.
I have the below function that I wrote which is used to display the information in a form.
fn futureAppts(){
local apptList
local i
local date
apptList = getfield(APPTS_BY_STATUS("scheduled", "FULL"), HRET, HRET)
for i = 1, i 0) then
//Remove past appointments that are still in "Scheduled" status
apptList = remove(apptList, i)
i = i - 1
endif
endfor
return str(apptList, HRET)
}