in order to create reports that have a page x of x for each donor in my database, I've written some code to loop through the db, and set the argument for my SQL query in the report, then print, one by one.
This starts off really good - creating pdfs at about 10-12 a minute. But, as it continues, it gets slower and slower.
i have found that if i run for a small range (say 100 at a time), it's fine, as long as the code stops, and i manually change the for loop, and run it again.
i can create 925 pdfs this way in less than an hour.
However, if i try to run from 1 -925 in a single loop, it takes more than 12 hours. I did this by starting it in the evening, around 6pm, and letting it run overnight. when i checked in the morning, it was only at 685 out of 925.
My code is below.
Does anyone have any suggestions? Maybe i'm not clearing something i should be clearing?
I'm using build 2787 - i think the appserver is v3538.
Whatever is the latest released version that appears when you start Alpha, and get the News and Updates tab.
thanks
This starts off really good - creating pdfs at about 10-12 a minute. But, as it continues, it gets slower and slower.
i have found that if i run for a small range (say 100 at a time), it's fine, as long as the code stops, and i manually change the for loop, and run it again.
i can create 925 pdfs this way in less than an hour.
However, if i try to run from 1 -925 in a single loop, it takes more than 12 hours. I did this by starting it in the evening, around 6pm, and letting it run overnight. when i checked in the morning, it was only at 685 out of 925.
My code is below.
Does anyone have any suggestions? Maybe i'm not clearing something i should be clearing?
I'm using build 2787 - i think the appserver is v3538.
Whatever is the latest released version that appears when you start Alpha, and get the News and Updates tab.
thanks
PHP Code:
delete PrintOptions
DIM PrintOptions as P
With PrintOptions
.Concatenate = .f.
.HasWatermark = .f.
.MultilingualSupport = .f.
.EmbedFonts = .f.
.LinearizeForWeb = .f.
.Colors2GrayScale = .f.
.ConvertHyperlinks = .f.
.WatermarkType = "Text"
.WatermarkText = "D R A F T"
.WatermarkFontName = "Times New Roman"
.WatermarkFontSize = 172
.WatermarkRotation = 450
.WatermarkColorHex = "E8FED2"
.WatermarkHorizPos = 120
.WatermarkVertPos = -120
.WatermarkOnTop = .f.
.WatermarkPDF = ""
.Encrypt = .f.
.OwnerPassword = ""
.UserPassword = ""
.CanPrint = .t.
.CanModifyDocument = .t.
.CanCopy = .t.
.CanAddNotes = .t.
.Use128BitKey = .t.
.JpegQuality = "High"
End with
dim args as SQL::Arguments
dim vDonor as c
dim vOutput as c
dim vPath as c
dim iDonor as n
vPath= "C:\\CdnDocuments\\"
for iDonor = 1 to 925
if iDonor < 10
vDonor = "9-000" + str(iDonor,1,0)
elseif iDonor < 100
vDonor = "9-00" + str(iDonor,2,0)
else
vDonor = "9-0" + str(iDonor,3,0)
end if
args.Clear
args.Set("WhatDonor", vDonor)
vOutput = vPath + vDonor + "_cu_deed_of_gift.pdf"
:Report.saveas("deed_of_gift_schedule_2","PDF","","",vOutput,.f.,PrintOptions,args)
next iDonor
Comment