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

2 subreports?

edited July 2005 in Subreports
i need help to create a report with 3 tables involved...

table A should be used to control the flow of the report and for a header on
the page, for each record on table A, i need to find all the record on table
B and all the records on table C...

all the reports found on table B, should be printed on the left side of the
report, all the records on table C should be printed on the right side of
the report....

how can i do this?


TIA

Comments

  • edited July 2005

    Master with two details that listed side by side. There is an example of
    this in RBuilder\Demos\Reports\Demo.dpr, number 73 (dm0073.pas).

    1. Define the linking relationship.

    See article below.

    2. Define the report layout

    - main report connected to the master pipeline
    - add two subreports, set ParentWidth to false and size the width
    - set them side by side


    ------------------------------------------------------
    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.


    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com





    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.