I need some help with trying to figure out how to display a list of all prior appointments with a particular doctor within a VFE form. Any Ideas?
Assuming that past appointments all have the same appointment status, you should be able to use the function APPTS_BY_STATUS to get a delimited string (HRET is the delimiter). You can take this string and convert into an array to run through a loop to get what you're looking for.
Something like this (warning: untested) should get you close:
fn getVisitHX()
{
local retStr = ""
local appt1 = APPTS_BY_STATUS("Checked Out", "FULL")
if appt1 "" then
appt1 = replacestr(appt1, HRET, ";")
tmp2 = getfield(appt1, ";", "")
for x = 1, x 0 then
tmp3 = getfield(tmp2[x], ",", "")
if DURATIONDAYS(tmp3[1], str(._TODAYSDATE)) < 0 then
if retStr == "" then
retStr = tmp3[1]
else
retStr = retStr + HRET + tmp3[1]
endif
endif
endif
endfor
endif
if retStr == "" then retStr = "No Visit HX" endif
return retStr
}
alternatively, you could also use a comma delimited list. Off of the top of my head
fn getVisitHx(var1)
{
local ApptArray = getfield(appts_by_status("Arrived","FULL),HRET,"")
count = 0
for count = 1, count 0 then result = result + "The last appointment was on " + ApptSubarray[1] + " at " + ApptSubarray[2] + " with " + ApptSubarray[6] + HRET
else ""
endif
endfor
}
var1 is the name of the provider. You can call the function from a data display, ie {getVisitHx(Jon Smith MD)}
for some reason it strips part of the text. count = 1, count "is less than or equal to" size(ApptArray), count = count + 1
do
ApptSubarray = getfield(ApptArray[count],",","")
if match(ApptSubarray,var1) > 0 then
result = ....