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

Please give me an example of looping thru a detail set pipeline

edited December 2002 in Datapipelines
Happy Holidays to ALL!

I need a code example.

I have a master dataset and report to generate.

For each master record I need traverse and pull totals and other data
elements from a
1->M linked detail dataset. The Master is DBPipeline1 and the detail is
DBPipeline3.
I was looking at OnTraversal of Pipeline1 but was not sure if that was the
proper way to approach the problem.

I would appreciate any direction on this matter.

Thank you.

Bill Lawler
Elite Brokerage Services, Inc

Comments

  • edited December 2002
    Hi Bill,

    Please take a look at the ReportBuilder Developer's Guide as there are
    tutorials on creating master detail reports to get you started. There is a
    PDF located in your RBuilder installation directory. The key is to use
    subreports to display the detail records connected to the detail dataset.

    There are a couple of alternatives to master detail linking using queries:

    ------------------------------------------------------
    Tech Tip: Linking SQL Queries for Master/Detail Data
    ------------------------------------------------------

    The following example shows two options for linking SQL queries to create a
    master/detail relationship.

    In this example, we are using Delphi's DBDemos data to create a
    Customer/Order relationship. Thus we wish to link the Orders detail to the
    Customer master.

    I. Delphi Query Linking
    ------------------------

    a. Set the detail TQuery.DataSource property to point to the master
    query's TDataSource component.

    b. In the SQL "Where" clause for the detail query use a ':' followed by
    the linking field name from the master:

    example
    select *
    from orders
    where orders.CustNo = :CustNo

    Now each time the master record position changes, the detail query will
    automatically be refreshed with the correct result set.


    II. RB DataPipeline Linking
    -----------------------------

    a. Set the detail DataPipeline.MasterDataPipeline to point to the master
    DataPipeline.

    b. Use the detail DataPipeline.MasterFieldLinks property to define the
    linking relationship

    c. In the SQL for the detail, retrieve all records and sort them by the
    linking master field:

    select *
    from Orders
    order by CustNo


    Notes:

    1. Using RB DataPipeline, each query is executed only a single time - thus
    performance is much faster.

    2. RB Professional and Enterprise Editions include a visual Data environment
    for creating SQL queries, defining linking relationships, and creating
    Ask-At-Runtime parameters. Using the RB tools you could create the above
    linked queries in about 10 seconds.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.