Avoid processing subreports that I set Visible := false
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
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
This discussion has been closed.
Comments
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;
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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
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