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

Printing a subreport when its pipeline returns no records

edited September 2003 in General
Hi,

does anyone know how to print the subreport even if the data pipeline that
it's connected to returns no data for a given master record? I tried to set
the SkipWhenNoRecords of the detail pipeline to false, but it doesn't help.

Maybe it helps if i add that i have another "detail" pipeline bind to the
pipeline that holds detail records (this pipeline is connected to the table
of customers, so that for each detail record i print, i get the customer
name instead of its ID).

All the pipelines are:

plMaster
|
->plDetail
|
-> plCustomer

Any suggestions? Should i set the SkipWhenNoRecords of those pipelines
differently (the plMaster has it set to true and the plCustomer to false).

Thanx

Comments

  • edited September 2003
    Hi,

    Be sure that you are setting the Report.NoDataSettings properly to get the
    effect you desire. Other than that, you should not have to create another
    detail pipeline to get a subreport to print when the data is null. If you
    are still getting this behavior, please send a small example demonstrating
    the issue in .zip format to support@digital-metaphors.com and I'll take a
    look at it for you.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2003

    Hi Nico,

    the Report.NoDataSettings solved the problem, as you said. Thanx very much.

    May i ask something else about this. When the detail pipeline has no data
    and the subreport prints, i should hide a band in the subreport(actually two
    bands - the detail band and a group header band). I tried to do this in the
    subreport's OnNoData event (ppGroupHeaderBand1.Visible := false;), but the
    band is hidden only when the subreport is secondly displayed (usually on the
    next page). I noticed that the ppGroupHeaderBand1BeforeGenerate fires before
    the ppChildReport1NoData handler, and because i hide the band in the
    OnNoData handler, the formatting (for the "current" subreport) isn't
    possible any more - the effects of the formating are displayed only when it
    next displays. Is it possble to detect that the pipeline has no records, so
    that i'd hide the band in its BeforeGenerate handler? Or is there a better
    solution?
  • edited September 2003
    Hi,

    When the detail band contains no data, you will need to use the
    DetailBand.BeforePrint event to keep track of the master record being used.
    From here you can set the Group Header's visibility to False on the master
    record that has no detail data. When the master record changes, you can set
    the Group Header's visibility back to True.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.