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

Avoid processing subreports that I set Visible := false

edited January 2004 in Subreports
Sorry if I post a question that has already been around. I haven't been able
to spot a posting that says anything about this.

I am making reports with lots of subreports. I only want to display approx.
half of the reports at a time, determined by some condition. I do this by
setting the different subreport's Visible property to false. This works
fine, those subreports are not printed. But it seems that they are
processed, even if they are not printed. This is a performance issue for me,
as those subreports are connected to time consuming queries. I have tried to
set the Visible property in the OnPrint event of the subreport and before
calling the report's Print method. Neither way seems to avoid the hidden
subreports being processed.

Is there a solution to this?

Regards Claes Brandt, Consultant

Comments

  • edited January 2004
    Hi Claes,

    In order to keep your subreports from processing, you will need to
    (temporarily) disconnect them from the datapipeline they are connected to.
    You can access the datapipeline of a Subreport by using the
    TppSubreport.DataPipeline properties and setting the DataPipeline to nil.

    mySubreport.Visible := False;
    mySubreport.DataPipeline := nil;



    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2004
    Hi Nico,

    Thanks for the fast answer. If I place this code in the subreport's
    OnPrint event, it seems that I don't get any data at all. I have also
    added code to make the subreport visible and adding the pipeline again.

    Regards Claes



  • edited January 2004

    You need to assign the datapipelines prior to calling the report. When you
    call Report.Print, the report engine initializes all of the datapipelines
    connected to reports and child reports.





    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.