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

Printing a report

edited November 2003 in General
I have a one page report that takes a while to generate. After it's
generated and sent to the viewer for display I then click the print button
to print it, why does the report recalculate everything before sending it to
the printer?
Is there a way to simply send what's in the viewer to the printer with out
going through the report generation again?

David

Comments

  • edited November 2003
    Oh and also on this report I have calculated values displayed in the viewer.
    When I print this report, all the values are now doubled, if I print it
    again they are trippled. How would I keep the calculations from happening
    with each print event?

    David

  • edited November 2003
    Hi David,

    The reason ReportBuilder needs to regenerate all the pages again when
    printing is that they are not saved in memory when previewing. To increase
    the speed, try turning the Report.CachePages to True and see if that helps.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2003
    Which event are you making the calculations in? Try calling Report.Reset
    between prints jobs.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2003
    I tried this and got an error. All of my code for the report is stored
    inside the template. In the Report.BeforePrint event in the template I
    added the line
    Report.Reset; and then tried to run the report, that's when I got the error.
    Is there anyway to reset the report from inside the template?

    David

  • edited November 2003
    My Report.CachePages is set to True. Anything else?

    David

  • edited November 2003
    Hi David,

    Please send an example of this to support@digital-metaphors.com and I'll
    take a look at it.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2003
    Let me explain what I'm trying to do and maybe you will have a little more
    insite. I have a deposit table that has 58 fields in it that contain
    various values for things such as late charges, bad checks, interest paid,
    principal paid and other things as well. I need to build a section of the
    report dynamically based on weather or not these fields do not equal 0.
    Right now I'm using 4 TStringList components created in the GlobalOnCreate
    event of the report, then they are initialized in the Report.OnPrint event.
    One string list contains the description of the accounting entry, one holds
    a count of the entries in this type and the other two hold the accumulated
    total and average of the entries for each type. I'm using report templates
    because there are so many different reports that I didn't want to have 50 or
    so report objects on the form. All the code for each report is stored in
    the template, which is where all the calculations are summing the above
    string lists. When I preview the report the values appear to be correct for
    each type, however, if I print the report, the values are again calculated
    making the printed report values that are twice what they should be. If I
    then print the report again the values are trippled and so on.

    Is there away to insure, from inside the template, that when I click the
    print button the report starts fresh as if this were the first time is was
    run?

    David

  • edited November 2003
    Hi David,

    Sorry, I was unaware you were using RAP to construct your reports. How are
    you populating the StringLists? Be sure you are freeing the TStringList
    objects once you are finished with them. How are you displaying the values
    inside the StringLists? My first suggestion would be to get this working
    without RAP, just using Delphi event handlers. This will allow you to debug
    our/your code using Delphi to find the issue. Then once it is working, you
    can port the code over to RAP.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2003
    I think I've got this one licked. What I did was, I wrote a function that
    initializes the stringlists (clears them then populates them with the base
    data). I am now calling this routine from the OnPrintDialogClose event
    which appears to be working. I also re-initialize any needed global
    variables in this event as well.

    Thanks for your replies!
    David Looney

This discussion has been closed.