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

Subreports pbFixed print behavoir - Record Not found error

edited April 2004 in Subreports
I am using Delphi 6 and RBuilder 7.03 Pro.

I have a report that is split into 3 columns on a landscape page. This
report has a subreport on it. I don't want this subreport to span onto the
next column, because there needs to be new information on that column. I
want the subreport to stop printing at the bottom of the column.

If I set the PrintBehavior to pbChild, all the data prints, but it spans
into the next columns if it runs too far down the page. I can't have this,
so I figured I could just set it to pbFixed and that would do it. Now, when
I run the report, page 1 displays on the page, but I get an error saying
'ORDER_: Record Not Found.'

A little more information on how I am accomplishing this: I have a TAdsQuery
running the main report. The subreport is running off of a TAdsTable,
linking the MasterSource to the query and the masterfields to the datafields
it needs to run off of.

The only time that this error appears is if I set the PrintBehavior to
pbFixed.

Any ideas here?

Thanks in advance,
David Lawnicki

Comments

  • edited April 2004

    Have not heard of this before. Sounds like a data linking issue, though I do
    not know why it would only manifest itself for the Fixed style subreport.
    Note that there are two ways to link datasets in ReportBuilder: Delphi
    TDataSet linking and ReportBuilder DataPipeline linking. These are mutually
    exclusive - use one technique or the other, but not both. See article below.

    ------------------------------------------------------
    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
  • edited April 2004
    I have also tried to link the pipelines together. I have removed the linking
    from the dataset to the query. Then on the pipeline, i set the
    'MasterDataPipeline' to the main pipe. Then I set the MasterFieldLinks to
    link my guid between the two databases. This works somewhat...

    If I do it this way, the report takes about 5 seconds per page to generate,
    and once the data appears, all the information for that pipeline, on the
    first report will disappear. If I move to the next page and then back, the
    data reappears, but if I move to the last page and back to the first, it is
    gone again. If I try to print, sometimes the information appears, sometimes
    it doesn't.

    Very strange behavior. Since I couldn't get this working, I ended up
    dropping memo fields on the report and filled the information out with code.
    It seems to work, but a lot more work than I was hoping to do to get 4
    fields of information out of a linked database.

    Dave Lawnicki

  • edited April 2004
    Thanks for the additional info. ReportBuilder does not currently support
    DataPipeline linking on GUID fields. If you need to establish a linking
    relationship on a GUID field, try using the Delphi Query linking. I think
    you need to use two TAdsQuery objects rather than a TAdsQuery and a
    TAdsTable (not sure, but that is my guess).


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