none
printing in loop in visual foxpro report writer RRS feed

  • Question

  • Hello Friends,

    I have a problem in printing in loop in vfp Report Writer. Following is my code.

    	LOCAL laPrnInfo
    laPrnInfo = ""

    FOR i=1 TO ALEN(dc,1) IF SEEK(dc(i),"pthd") laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; " Dr. "+pthd.docname ELSE =SEEK(dc(i),"rdrp") laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; " Dr. "+rdrp.docname ENDIF =SEEK(dc(i),"dct") laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; " "+dct.docaddr1+" "+dct.docaddr2 laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; " "+dct.docdist laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ "" laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; " Dear Doctor" laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; " We thank you very much for refering cases to us for investigations." laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; " The details are as below :" laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; REPLICATE("-",72) laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; " Date USG X-Ray Pathology Commission" laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; REPLICATE("-",72) FOR j=1 TO ALEN(dat,1) IF m.cl=1 laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; " "+DTOC(dat(j,1))+" "+STR(dat(j,2))+" "+STR(dat(j,3))+" "+STR(dat(j,4),10,2) m.cl=2 ELSE laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; " "+DTOC(dat(j,1))+" "+STR(dat(j,2))+" "+STR(dat(j,3))+" "+STR(dat(j,4),10,2) m.cl=1 ENDIF ENDFOR laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; REPLICATE("-",72) laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; " Total "+STR(tot(1))+" "+STR(tot(2))+" "+STR(tot(3),10,2) laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; " Commission "+STR((tot(1)*stp.crusg)-m.totdisc1,10,2)+" "+STR((tot(2)*stp.crxray)-m.totdisc2,10,2)+" "+STR(tot(3)*stp.patgen/100,10,2) laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; REPLICATE("-",72) laPrnInfo=laPrnInfo+IIF(EMPTY(laPrnInfo),"",CHR(13)+CHR(10))+ ; " TOTAL COMMISSION: "+SPACE(44)+ALLTRIM(STR((tot(1)*stp.crusg)+(tot(2)*stp.crxray)+(tot(3)*stp.patgen/100)-m.totdisc1-m.totdisc2,10,2)) RELEASE dat m.cl=1 STORE 0 TO tot ENDFOR REPORT FORM report\rptdct.frx TO PRINTER PROMPT PREVIEW NOWAIT

    when I put laPrnInfo in detail band of the report then data is reated by number of records in array. And if I put LaPrnInfo in page Header of report, only page 1 is printed and other data is left. 

    Tariq Iftikhar

    Saturday, January 26, 2019 3:28 PM

Answers

  • The VFP Report Writer is designed to work with tables and cursors not arrays. Populate a cursor instead of an array and things should go much better.

    Tamar

    • Marked as answer by Tariq Iftikhar Tuesday, February 5, 2019 3:36 AM
    Monday, January 28, 2019 9:38 PM
    Moderator

All replies