Notifications
Clear all
Topic starter
I need help with creating a function for a letter that will display the next appointment for a specified appointment type, or types.
Thanks in advance!
Posted : July 16, 2014 1:15 am
redde said:
I need help with creating a function for a letter that will display the next appointment for a specified appointment type, or types.
Thanks in advance!
Here is a function we use that will return all upcoming appointments with appointment type "Office Visit". Please note that the function will only return appointments with a status of "Confirmed". This should get you started - let me know if you have any questions.
{fn upComingApptList(){ local retStr = "" local apptArrayOV1 local apptArrayOV2 local apptArrayOVDTL_DATES = array("DELETE", "ME") local apptArrayOVDTL_TIMES = array("DELETE", "ME") local apptArrayOVDTL_TYPES = array("DELETE", "ME") local apptArrayOVDTL_PROV = array("DELETE", "ME") if APPTS_BY_STATUS("Confirmed", "FULL") <> "" then apptArrayOV1 = getfield(APPTS_BY_STATUS("Confirmed", "FULL"), "\r", "") for x = 1, x <= size(apptArrayOV1) - 1, x = x + 1 do apptArrayOV2 = getfield(apptArrayOV1[x], ",", "") if match(apptArrayOV2[3], 1, "Office Visit") > 0 and durationdays(apptArrayOV2[1], str(._TODAYSDATE)) < 0 then INSERT(apptArrayOVDTL_DATES, size(apptArrayOVDTL_DATES) + 1, apptArrayOV2[1]) INSERT(apptArrayOVDTL_TIMES, size(apptArrayOVDTL_TIMES) + 1, apptArrayOV2[2]) INSERT(apptArrayOVDTL_TYPES, size(apptArrayOVDTL_TYPES) + 1, apptArrayOV2[3]) cond case size(apptArrayOV2) == 6: INSERT(apptArrayOVDTL_PROV, size(apptArrayOVDTL_PROV) + 1, apptArrayOV2[6] + " " + apptArrayOV2[5]) case size(apptArrayOV2) == 5: INSERT(apptArrayOVDTL_PROV, size(apptArrayOVDTL_PROV) + 1, apptArrayOV2[5]) endcond endif endfor endif if size(apptArrayOVDTL_DATES) <= 2 then retStr = "No Office Visit Appointment Scheduled." else for x = 3, x <= size(apptArrayOVDTL_DATES), x = x + 1 do if retStr <> "" then retStr = retStr + HRET endif retStr = retStr + apptArrayOVDTL_DATES[x] + " " + apptArrayOVDTL_TIMES[x] + " -" + "\t" + apptArrayOVDTL_TYPES[x] if apptArrayOVDTL_PROV[x] <> "" then retStr = retStr + "," + apptArrayOVDTL_PROV[x] endif endfor endif if retStr <> "" and match(retStr, 1, "\n\n") > 0 then retStr = replaceStr(retStr, "\n\n", "\n") endif return retStr }}
Posted : July 16, 2014 4:57 am
Topic starter
Thank You!!!!
I made some adjustments to the function and got it to do what I need.
Posted : July 16, 2014 6:11 am