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

Printing new fields show other datas..

edited September 2005 in General
Hi,

I realized that when I use tables (dataviews) just to connect other two
tables, my report doesn't not show the correct data.

For instance (a exemplo of this can be downloaded at
http://geocities.yahoo.com.br/giljustino/reports.zip),
The report "first.rtm" are using 4 dataviews. I added inside the detail
band the field "Nome Segurado". When I execute the report, it shows for
all the records the same value. The output for this report is "first.pdf".

A just modified this report, adding for each dataview, one field inside
the detail band (actually, it was one of the fields used to connect each
dataview) and I don't understand why, but it affected the way how the
last field in the detail band worked. You can see this happend looking
the output report second.pdf. Now it has 3 new columns but the last
column is not showing always the same value for each record.

But actually the right output is second.pdf. And a strange thing is If I
delete all the fields I added in the second report, in such a way it
became equal the first report, the output is almost like the output
"second.pdf". I mean, of course, it just show the first column and the
last one, but the last column starting showing diferent values, as
showing in the report "second.pdf".

I would like if someone could explain this to me. It seems this is a bug.

I tested it with RBuilder 7 and Delphi 7, connecting with DBExpress.

Thanks!
Gilvan Justino

Comments

  • edited October 2005
    Hi Gilvan,

    A report will only traverse one dataset at a time. When you are designing a
    report, the datasource defined in the Report | Data option in the menu is
    the data that will be traversed. If you need to traverse more than one
    dataset in a single report, you will need to use Subreports.

    ------------------------------------------------
    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
This discussion has been closed.