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

Forcing detail data to print on 2nd page if greater than x records

edited December 2008 in General
Hi,

I have a report designed the following way:

The Header contains 2 Subreports. (Subreport1 and Subreport2)
The Detail band contains the list of records I wish to print.
The footer band contains static text for the footer.

Within the header, I choose to print Subreport1 when Pageno = 1, and
Subreport2 when Pageno <> 1. This allows me to choose a particular format
for the first page, and have an addendum for every subsequent pages if the
recoreds to print go over 1 page.

I have just had a request from a user that they only want records to print
on the first page if there will only ever be one page. If the number of
records will not fit in the first page, they want the first page to not
print the detail band at all (but print something else in it's place, saying
"See addendum"), and have all the records print on the subsequent page(s).

I can calculate whether or not this event will occur by the recordcount
property of the dataset - however what I'm stuck on is trying to figure out
how to get the first page not to print the detail band at all if the
recordcount is greater than x.

Does anyone have any ideas on how I could go about achieving this?

Thanks & Regards

Adam.

Comments

  • edited December 2008

    Rather than using the Header to conditionally print the two subreports, try
    this...

    Title - contains Subreport1. (the title band only prints at the start of the
    report)

    Header - contains Subreport2. Set Header.PrintOnFirstPage to False.

    Now at this point the report should generate like your current report.

    For the next requirement, conditionally set TitleBand.NewPage to true/false
    based on the record count.

    // conditionally generate detail on the next page
    if myDataSet.RecordCount > Max then
    TitleBand.NewPage := True
    else
    TitleBand.NewPage := False;


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2008
    Hi Nard,

    Beautiful - Spot on!

    Thanks very much!

    Adam.
This discussion has been closed.