On a fake patient, I created 5 appts with status of 'arrived' .
Inside Data Display:
{APPTS_BY_STATUS("arrived")}
gives me
01/25/2013 8:45 am
01/25/2013 10:30 am
01/27/2013 9:00 am
01/29/2013 9:00 am
01/29/2013 1:15 pm
I have a function
{
fn foo()
{
local appts_list = getfield(APPTS_BY_STATUS("arrived"),HRET,"")
return appts_list[1]
}
this gives me:
01/25/2013 8:45 am
but returning appts_list[2] gives me NOTHING......why?
I have tried "\n" AND "\r" as the delimiting character inside getfield() and I get absolutely nothing.......why?
I have seen this before, your second appt is hiding in appts_list[3], and every appointment is in the odd numbers. I don't remember exactly what the solution is but try one of these -
local appts_list = getfield(APPTS_BY_STATUS("arrived"),\n\r,"")
local appts_list = getfield(APPTS_BY_STATUS("arrived"),\r\n,"")
local appts_list = getfield(APPTS_BY_STATUS("arrived"),HRET,"\r")
Thanks. I eventually got it to work with the following code:
{
fn appts_last_three_days(){
local appts_list = ""
local return_string = ""
appts_list = getfield(APPTS_BY_STATUS("scheduled"),HRET,"\r")
FOR i=1,i<=size(appts_list),i=i+1
DO
if(appts_list[i]<>"")then
if(val(DURATIONDAYS(sub(appts_list[i],1,10),str(._TODAYSDATE)))<=3)then
return_string = return_string + appts_list[i] + HRET
endif
endif
ENDFOR
return return_string
}
}
Even elements are blank, and odd elements have dates as you said. I have no idea how to populate them normally (i.e. 1,2,3,4,5 instead of 1,3,5,7,9).