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

Re: Ghost Blank pages

edited August 2003 in Subreports
Hey all,

This one is really spooky. Here's the basic layout of the report.

Title
SubReport1(CoverLetter)
SubReport2(Legend Explanation of codes in detail)
Header
6 Labels
SubReport3(Couple labels filled out if data exists)
SubReport4(Header for detail)
Detail
Region(Lots of ppdbMemos)
Footer
(White space for pagestyle)
PageStyle
Region(Makes box around enclosed info for cosmetics)
System Variable(Page 1 of 5)

I load the report with Delphi from the database using
ppreport1.Template.DatabaseSettings.Name := 'OpeningDetail (Short)';
ppreport1.Template.LoadFromDatabase;
ppReport1.DetailBand.BeforeGenerate := ppDetailBand1BeforeGenerate;

I have code that will turn off the following reports depending on what the
EU wants to print.
SubReport1(CoverLetter)
SubReport2(Legend)

1. I always get blank page for the first page with the two subreports turn
on.
2. When I shut the two subreports off(Make them invisible), I receive a good
data on the first page, bad data on the next three pages and then good data
on the last page(Same as page one).

If shut off two pass, I receive a good report but the system variable will
not be entirely accurate. Page 1 of 1 when it could be Page 1 of 5. The data
I am using is pretty small subset for testing purposes but the report could
be a 100 pages or so depending on the dataset. I thought maybe it was the
beforePrint firing because the bad data on the three pages resembled the
detail section of the main report. So I shut off the beforePrint event
entirely. That did not work either. I am not using RAP or DADE. I configure
the report from the design mode within my application.exe. To access fields
that I need to manipulate at run time, I wrote on functions to turn off/on
visibility or set the text of a label or make a subreport visible. Here's a
sample.

procedure SetppComponentVisible(aComponentName : String; IsVisible :
Boolean; aReport : TppCustomReport);
var
liBand : Integer;
liObject : Integer;
liRegion : Integer;
lObject : TppComponent;
begin
for liBand := 0 to aReport.BandCount-1 do
for liObject := 0 to aReport.Bands[liBand].ObjectCount-1 do
begin
lObject := aReport.Bands[liBand].Objects[liObject];
if ((lObject is TppSubReport) and (TppSubReport(lObject).Report <>
nil)) then

SetppComponentVisible(aComponentName,IsVisible,TppSubReport(lObject).Report)
else
begin
aReport.Bands[liBand].FindObject(lObject);
if lObject.Username = aComponentName then
lObject.Visible := IsVisible;
lObject := nil;
end;
end;
end;

Any insight on this dilemma would be greatly appreciated.

Thanks for your time in advance.
Tim
www.curries.com

Comments

  • edited August 2003
    I figure out that the subreport was being called on the wrong event. So
    number is taken care of. Thanks.

  • edited August 2003
    Number 2 in the list in the first message is taken care of.

  • edited August 2003
    The blank first page is probably caused by the fact that the first component
    to generate in the report is a section style subreport. Change the first
    subreport to be printed to be a child type subreport and it should begin
    printing on the first page.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.