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

Sub Report places data on incorrect line of report

edited October 2004 in Subreports
I have a report that contains a sub-report which calculates employee
renumeration, The problem I am having is that the data from the sub report
actually prints on the line after the line it is supposed to be on. ie the
correct value shows up for the next employee not the one it is supposed to
show for .
Anybody know why this is so. Is it a timing issue?
I have tried all available timings to no avail.
Matthew Pallett(Systems Analyst)

Comments

  • edited October 2004

    There is not enough information here for me to diagnosed the problem.

    1. Make sure that the data is linked correctly. (see article below).

    2. Run RBuilder\Demos\EndUser\ReportExplorer and RBuilder\Demos\Reports and
    check out the linking examples and the master/detail examples.

    3. As a test you can try commenting out the event-handler code associated
    with the report. Make sure that you do not have code that manipulates the
    dataset in any manner while the report is generating.

    4. If you still have an issue, please create a simple example using standard
    Delphi components, ReportBuilder and the DBDemos data. Email in zip format
    to support@digital-metaphors.com and we can check it out here.


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



    Best regards,

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