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

Master-Detail Report

edited November 2006 in End User
I'm trying to do something fairly simple with report builder but results
aren't working. Basically trying to build a Customers Reports with the
multiple Shipping Addresses, i.e. Customer Name/Code & Billing Address in
the Header. Then in the detail band, list the multiple ship-to addresses.
I'm getting a listing that doesn't jive. I setup a query with an inner join
for Shipping_Addresses.Customer_ID=Customers.Customer_ID.
The results are giving me multiple shipping addresses for
Shipping_Addresses.Customer_ID <> Customers.Customer_ID???

Any ideas,
Don

Comments

  • edited November 2006
    Hi Don,

    I would recommend creating two datasets and linking them on the customer ID
    field. You will need to be sure you order your detail dataset by the
    customer ID. Take a look at the main reports demo for some good examples of
    creating master-detail reports with ReportBuilder. Also take a look at the
    article below.

    ------------------------------------------------
    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 November 2006
    Nico,
    I don't see a Report.DataPipeline property on my report at all. The
    Report Tree only contains 3 groups: Header, Detail and Footer. I can see
    properties for the objects I created under each such as DBMemo, DBText, etc.
    If I go to the Data tab, I just have a query Selecting fields from 2 tables
    where Customers.Customer_ID = Shipping_Addresses.Customer_ID and Order By
    Customers.Customer_Code. All I want is a report in a one-to-many
    relationship. Each customer in the Header and each customer's shipping
    addresses in the detail band.
    I believe this is a Design issue but can't see how to assign the
    Report.DataPipeline property????

    Don
  • edited November 2006
    Nico,
    Also, I don't have the complete Report Builder product. I am using a
    run-time version embedded or linked into an Accounting System we use here so
    some of the documentation doesn't apply. For example, if I go into the
    Accounting System, Administration, Utilities, Custom Report Designer, I get
    a new report. If I go to the Data tab, there is nothing on the screen. You
    can't right click or anything. I have to go to File-New and create a report
    via a query and then I can see tables.

    FYI,
    Don
  • edited November 2006
    -----------------------------------------
    Article: End-User Tech Support
    -----------------------------------------

    Please understand that Digital Metaphors can only provide tech support to
    the Delphi developers that purchase ReportBuilder. Digital Metaphors
    receives no distribution royalties from Delphi developers that embed
    end-user reporting solutions in their applications. It is the responsibility
    of the software publishers that sold you the product to provide you with
    tech support.

    There is an end-user tutorial called Learning ReportBuilder that can be
    downloaded from our web site for free. See the following article for more
    information.

    --------------------------------
    Article: Learning ReportBuilder
    --------------------------------

    Learning ReportBuilder is a complete learning system designed to teach end
    users how to build a range of reports. This system includes a 125-page PDF
    file, a stand-alone application complete with a database, and a help file.
    The PDF file is comprised of a series of tutorials that step end users
    through the process of building reports as simple as a table listing and as
    complex as crosstabs. The tutorials also introduce conceptual aspects of
    report building along the way. The application is used in conjunction with
    the tutorials so that the learning experience is interactive. The end user
    just prints out the PDF file, runs the application, and learns
    ReportBuilder. The help file is accessible from the application, so all
    three tools work together to provide a seamless learning environment.

    Learning ReportBuilder installs into C:\Program Files\LearnReportBuilder.
    When the system has successfully installed, a complete set of instructions
    appears in the form of a 'ReadMe' doc, so the end user knows just what to do
    upon installation.

    - Download Learning ReportBuilder

    http://www.digital-metaphors.com/LearnRB/LearnRB.exe

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2006
    Nico,
    I figured it out. Simply went to the menu Reports-Groups and created a
    group, grouped by the Customer_ID. Worked perfectly. It was right in front
    of me but couldn't see it.

    Tks for the help,
    Don
This discussion has been closed.