Hello,
I am trying to show in a Data Display all of a patient's future appointments that are pending. Does anyone have the code for this?
Thanks,
Rachel
{fnfutureappt(){
napptz="" today=str(._todaysdate) retstr="" b="" apps=""
apps=appts_by_Status("scheduled","FULL")
napptz=getfield(apps,"\r","\n") sz=size(napptz) if apps="" then sz=0 else "" endif
for i=1, i<sz, i = i+1
do
napptz[i] = getfield(napptz[i],",","\r")
dur=durationdays(today,napptz[i][1]) If dur>0 then retstr=retstr+ napptz[i][1] +" "+ napptz[i][4] +" "+ napptz[i][2] + HRET else "" endif
if dur<>0 then "" else if napptz[i][4]<>"" then retstr=retstr+fmt("Today ","B,I")+" "+napptz[i][4]+" "+ napptz[i][2] + HRET else "" endif endif
endfor
if retstr="" then retstr=" None" endif
if napptz[1][1]="<" then retstr=" None " endif
return retstr
}}
Thank you. I am getting this Build Error:
ERROR: Possible syntax error in function definitions. Either function definition without preceding "fn " or MEL expression without opening "{". Expression beginning
No appointments are showing in the Data Display when importing form into EMR. Any thoughts as to how to fix this?
Thanks,
Rachel
Sorry, I should have been more specific. Define the function in the functions window of VFE like this:
fn futureappt()
{
napptz="" today=str(._todaysdate) retstr="" b="" apps=""
apps=appts_by_Status("scheduled","FULL")
napptz=getfield(apps,"\r","\n") sz=size(napptz) if apps="" then sz=0 else "" endif
for i=1, i<sz, i = i+1
do
napptz[i] = getfield(napptz[i],",","\r")
dur=durationdays(today,napptz[i][1]) If dur>0 then retstr=retstr+ napptz[i][1] +" "+ napptz[i][4] +" "+ napptz[i][2] + HRET else "" endif
if dur<>0 then "" else if napptz[i][4]<>"" then retstr=retstr+fmt("Today ","B,I")+" "+napptz[i][4]+" "+ napptz[i][2] + HRET else "" endif endif
endfor
if retstr="" then retstr=" None" endif
if napptz[1][1]="<" then retstr=" None " endif
return retstr
}
Call the function in the data display like this:
{futureappt()}
I am getting this in the note:
fn futureappt()
{
napptz="" today=str(._todaysdate) retstr="" b="" apps=""
apps=appts_by_Status("scheduled","FULL")
napptz=getfield(apps," "," ") sz=size(napptz) if apps="" then sz=0 else "" endif
for i=1, i
do <-COMPILER ERROR NEARBY: Expect COMMA. Instead had DO KEYWORD after IDENTIFIER
You didn't copy and paste all the code. Make sure to paste into notepad first to remove any formatting.
That worked.....Do you know how to bring in the name of the appointment book?