Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Recreating Pipeline Fields, Clearing Cache

edited May 2002 in General
We have a Delphi 5 App, using ReportBuilder 6.03. We allow users to create
their own report templates, cloning from other templates, they store them
into database, etc. Then these reports can be launched as a result of
customizable events in our system. Anyway, since there are so many reports
that can be run, in various orders and combinations, we send all printing
jobs to an external app that processes them on a timer. This external app
recreates the user's requested custom report from 1 of 7 basic templates,
each of which has a different combination of available datasets and
pipelines setup, ready to go.

So, my question... To keep from having several thousand pipeline fields
loaded at any one moment in time, along with dozens of TppReport objects, we
are constantly resetting one ppReport1, doing a ppReport1.Template.New, and
freeing/recreating all pipeline fields on the fly. Our users have found
that after a random number of reports created (generally around a hundred of
so), they often get an access violation from our printing app. Best we can
tell, the av traces back to a TppCommunicator.Notify event, if that means
anything.

What steps do we need to be taking in code to effectively reuse a TppReport
object, while always freeing/recreating its pipeline fields? Currently, we
always (as we are looping through their report requests on a timer):

ppReport1.Reset;
ppReport1.Template.New;
// close all datasets from old reports (either TQuery or TAstaClientDataSet)
// change Visible := False for all pipelines for old reports
// load pipeline fields for new report (ppDBPipeline.DefineField)
// get the template from db, reload ppReport1's template
(ppReport1.Template.LoadFromStream(ReportStream);)
// execute our sql for new report (the datasets already point toward the
correct pipelines)
// mark the relevant pipelines visible for our new report (main pipeline and
any subreport pipelines)
// set the pipeline for ppReport1 (ppReport1.DataPipeline := ...)
// do our printing/preview/email, etc.
// free all pipeline fields for report that just printed
(ppDBPipeline.FreeFields)
// free all pipeline bookmarks for report that just printed
(ppDBPipeline.FreeBookmarks)

Then we start the whole process over. Are there any steps that we are
omitting that might leave a hole for a random av, maybe not freeing some
cache that is used in the report, etc.? Thanks for any help,

Ben Sykes
- IndySoft -
bens@indysoft.com
www.indysoft.com
This discussion has been closed.