I'm looking for a function that will list the provider of the next scheduled appt, instead of LOC.
Thank you!
arg 'delim' for '|' & '^'
'' for hret & ','
mine 'mine' for current user's appts
'all' for all users appts
next 'next' for only next appt
'all' for all appts
{fn ListFutureAppointments(arg, mine, next)
{
local rec_delim = ""
local field_delim = ""
local count
local appt = array()
local atype
local book = array()
local bookcount
local loc
local username
local i = 0
local j
local status
local result = ""
if arg=="delim" then
rec_delim = "|"
field_delim = "^"
else
rec_delim = hret
field_delim = ", "
endif
count = getRowCount("_MELCurPatientAppt") // _MEL???? are global variables from mellib.txt
// Loop thru patients appointments and stop after first for current user
while i<count
and (next<>"next"
or (result==""
and next=="next")) do
appt = getRow("_MELCurPatientAppt", i, "ApptDate", "ApptTime", "Appttype", "Booklist", "ApptStatus")
// Check for future appointment
if VAL(appt[1])>=._TODAYSDATE then // doesn't look right
// if DURATIONDAYS(appt[1], str(._TODAYSDATE))>0 then // told doesn't work
// Get the type of appointment ... ApptType from _MELApptDef where ID = appt[3]
atype = find("_MELApptDef", "ApptType", "ID", appt[3])
// Get the books associated with appointment
book = getfield(appt[4], ":", "")
bookcount = size(book)
// Loop thru books
j = 2
while j<bookcount do
// Is appointment still scheduled
if appt[5]==0 then
// Get the location of care from the each book
loc = find("_MELBook", "LOCID", "ID", book[j])
loc = find("_MELLoc", "Name", "LOCID", loc)
// Get the user name from the each book
username = find("_MELBook", "UserName", "ID", book[j])
// Build the result if book matches current user
if mine=="all"
or (mine=="mine"
and match(username, 1, user.firstname)>0
and match(username, 1, user.lastname)>0) then
if result<>"" then
result = result + rec_delim
endif
result = result + appt[1] + field_delim + appttime(appt[2]) + field_delim + loc + field_delim + username
endif
endif
j = j + 1
endwhile
endif
i = i + 1
endwhile
return result
}
}
Is there a quick text to share that would pull the next appt with the same LOC/provider?? Regards
create a quicktext with ListFutureAppointments("", "mine", "next").
the above function will have to be pasted into usrlib.txt so the quicktext can find it.
Thank you, will give it a shot.
arg 'delim' for '|' & '^'
'' for hret & ','
mine 'mine' for current user's appts
'loc' for current loc's appts
'all' for all users appts
next 'next' for only next appt
'all' for all appts
{fn ListFutureAppointments(arg, mine, next)
{
local rec_delim = ""
local field_delim = ""
local count
local appt = array()
local atype
local book = array()
local bookcount
local loc
local username
local i = 0
local j
local status
local result = ""
if arg=="delim" then
rec_delim = "|"
field_delim = "^"
else
rec_delim = hret
field_delim = ", "
endif
count = getRowCount("_MELCurPatientAppt") // _MEL???? are global variables from mellib.txt
// Loop thru patients appointments and stop after first for current user
while i<count
and (next<>"next"
or (result==""
and next=="next")) do
appt = getRow("_MELCurPatientAppt", i, "ApptDate", "ApptTime", "Appttype", "Booklist", "ApptStatus")
// Check for future appointment
if VAL(appt[1])>=._TODAYSDATE then // doesn't look right
// if DURATIONDAYS(appt[1], str(._TODAYSDATE))>0 then // told doesn't work
// Get the type of appointment … ApptType from _MELApptDef where ID = appt[3]
atype = find("_MELApptDef", "ApptType", "ID", appt[3])
// Get the books associated with appointment
book = getfield(appt[4], ":", "")
bookcount = size(book)
// Loop thru books
j = 2
while j<bookcount do
// Is appointment still scheduled
if appt[5]==0 then
// Get the location of care from the each book
loc = find("_MELBook", "LOCID", "ID", book[j])
loc = find("_MELLoc", "Name", "LOCID", loc)
// Get the user name from the each book
username = find("_MELBook", "UserName", "ID", book[j])
// Build the result if book matches current user
if mine=="all"
or (mine=="mine"
and match(username, 1, user.firstname)>0
and match(username, 1, user.lastname)>0)
or (mine=="loc"
and match(loc, 1, user.curlocationname)>0) then
if result<>"" then
result = result + rec_delim
endif
result = result + appt[1] + field_delim + appttime(appt[2]) + field_delim + loc + field_delim + username
endif
endif
j = j + 1
endwhile
endif
i = i + 1
endwhile
return result
}
}
create a quicktext with ListFutureAppointments("", "loc", "next").
the above function will have to be pasted into usrlib.txt so the quicktext can find it.
this will return the next appt for the current users home LOC.