Home Subreports

problem to assotiate details in sub report with record from mastrer

edited February 2003 in Subreports
Hello,

I am wondering if you could help me out with the following difficulty.

I have to create a report using Delphi and Report Builder. The idea is
to display some financial information, record by record, with a column
one last column that displays details (such as some ID and amount) for
the records. For displaying the details, I am using sub-report.

I created this report in Report Builder. I used 2 queries ? 1 for
master(using 3 tables) and 1 for sub-report(using a fourth table) and I
linked these two queries by some fields. I grouped the information on a
design tab and everything was working perfectly.
Than I tried the same thing with a queries with a parameters passed from
Delphi form. Each query was passed through different DBPipelines. One
DBPipeline as master and another as a childe and by using
MasterFieldeLink Property in Object Inspector of the Delphi, I tried to
link them. After that in RB I assigned DBPipelineMaster to master report
and DBPipelineChilde to SubReport. However it doesn't work the same ways
in RB stand alone.
Do you have any suggestions?

Thanks,

Natalia Skournik

Comments

  • edited February 2003

    Below is an article that explains two techniques for linking queries: Delphi
    TQuery linking and RB DataPipeline linking.....


    ------------------------------------------------------
    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
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2003
    Hello, Nard.



    Thank you for your prompt response.

    The second technique was quite similar to my approach, except for
    ordering by field. Your suggested ?Order By? helped me very much, and
    the report is functional now!



    Sincerely,

    Natalia Skournik



This discussion has been closed.