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

Repeating Report

edited September 2005 in General
I have a pretty simple report - a small header, a detail section pulling
data from one table (usually 2 to 3 records only) and a small footer. The
whole thing only takes up a third of a page. What I want to do is repeat the
*whole thing* three times to fill the page. I.e. exactly the same report, in
triplicate. I've tried setting the "bandsperrecord" to 3 and it does seem to
work to an extent - but I get the same page repeated at least twice also -
obviously all I want is one page. How would I go about setting up this
report?

Mike Combellack

Comments

  • edited September 2005
    I have done what you want and it works just fine for me.

    Place everything in the detail band, then set the bands per record of the
    detail band to 3 (in the detailbands.beforeprint event for example). If you
    need to, place a subreport in the detailband and move your entire current
    report inside the subreport. The point is to have everything in the
    detailband.

    I am using this to print complex looking labels, where the number of labels
    is read from the database itself.

    Cheers,
    Dimitar

    "Mike Combellack" ?????? ? ????????? ??
    ??????????? ?????:43386851@dm500....
  • edited September 2005
    Thanks for the reply. I have done that - everything is inside a subreport in
    the detail band. However, remember that this subreport also has a detail
    band - while the first page of the reprot is as I want, it then repeats that
    same page once for each record in the subreports detail band. How can I stop
    that?

    Mike Combellack

  • edited September 2005
    Hi Mike,

    If you would like your subreport data to change with each record change in
    the main report, you will need to set up a Master-Detail relationship
    between the two. See the following article.

    ------------------------------------------------
    TECH TIP: Fundamentals of Report Data Traversal
    ------------------------------------------------


    1. Single Table Listing Report

    Assign the Report.DataPipeline property and leave the
    DetailBand.Pipeline unassigned.

    The report will traverse the data from start to end (based on the
    datapipeline range settings and honoring any filters you've placed on
    the datset etc.)


    2. Master/Detail Report:

    A. Assign the Report.DataPipeline property to the master. Create a
    subreport in the detail band and assign the childreport.DataPipeline to
    the detail datapipeline.

    Use either the visual linking features available from the Report
    Designer's Data tab, or Use standard Delphi dataset linking to define
    the relationships between the datasets.

    The Report will traverse the master records and for each, the subreport
    will traverse the detail data related to the master.


    3. Master with 2 Details

    Configure as in 2 above. Add an additional subreport to the detailband.
    Set subreport.ShiftRelativeTo property to the point to the first
    subreport. Connect the ChildReport's DataPipeline to the detail data.


    4. Report connected to no datapipelines.

    When Report.AutoStop is set to True, the Report will print a single
    detail band.

    When Report.AutoStop is set to False, the Report will print detail bands
    until instructed
    to stop. You can control when the report stops by setting the
    Report.PageLimit property or by calling Report.DataTraversalCompleted
    method. Otherwise the report will never stop.


    Additional Notes:
    ----------------

    1. SubReports have a Report property that is of type TppChildReport.
    Thus, programmatically you can code SubReport.Report.DataPipeline :=
    myDataPipeline.

    2. ChildReport's traverse data following the same rules as above. A
    ChildReport prints in its entirety each time it gets a turn to print.

    3. For a Child style SubReport use the Title/Summary band rather than
    the Header/Footer (or use a GroupHeader/GroupFooter combo). A standard
    Header/Footer will not work because these always print at the very
    top/bottom of the page.

    4. Do not filter the dataset of modify it any way once the report.Print
    command is issued. If you need to do master/detail and cannot use
    linked datasets, then use the master DataPipeline.OnRecordPositionChange
    event to filter the detail dataset.

    5. The reports and datapipelines use dataset bookmarking. Make sure
    the dataset can support bi-directional navigation.



    Check out the RBuilder\Demos\Reports\Demo.dpr project. Reports 0071,
    0072, 0073 show examples of master w/mutliple detail style reports.
    Number 0072 has two detail reports.


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2005
    Thanks for the reply. I perhaps didn't explain my problem properly but your
    reply did contain the magic words I needed - "page limit"! I didn't know
    there was that property, so I have been able to cut my report off after that
    first page. Thanks again.

    Mike Combellack


This discussion has been closed.