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

Preview is alright (showing 1 page only) but then prints continuous stream of empty pages ???!!

edited June 2004 in RAP
Hey guys,

I have a report (who would have guessed?! ;-) and it shows just fine in the
preview. However, when I click the little print-button it starts to print a
continous stream of empty pages :-/

Has anybody seen this behaviour before and has found the cause?

During development I only sometimes printed a report trusting that the print
would be the same as the preview and I never had any errors like this. The
only thing changed since then is that we're now working on the
semi-production database and before on the test-database. I can't imagine
this has anything to do with it though...

What can cause a difference between the preview and the actual printing?

Any help is much appreciated.

Vince.

Comments

  • edited June 2004
    ------------------------------------------------------
    Article: TroubleShooting: Report Prints Endless Pages
    ------------------------------------------------------

    1. Check each report/childreport and make sure that the Report.DataPipeline
    property is assigned OR AutoStop is set to True.

    2. Try setting all Detailband.PrintHeight to phDynamic. It may be that you
    have a fixed height detail band that is too large to print on a page.

    3. As a test, try commenting out all event-handler code associated with the
    report. Make sure that you are not manipulating the dataset in any manner,
    while the report is generating. This can cause the report engine to get
    lost.

    4. Save the report under a new name and try incrementally simplifying it
    until the issue goes away. Then incrementally add complexity until you
    isolate the cause of the error.

    If you still have an issue after performing the above steps, please create a
    simple, minimal Delphi project and e-mail to support@digital-metaphors.com
    in zip format.


    --
    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
  • edited June 2004
    Hello again,

    Sorry for the late reply, I haven't been working on this since last
    monday...

    I found out that I have code in the ppReportBeforePrint event. The code
    loops through a dataset. That dataset has an AfterOpen and an AfterScroll.
    In the AfterOpen and in the AfterScroll a query (depending on values from
    the selected record in my main recordset) is activated that is required for
    my subreport.

    My problem disapears when:
    A) I disable the line in the afterscroll where I activate the query for my
    subreport
    or
    B) I delete the subreport completely.

    Either is not a solution because I need my subreport.

    Option A is strange because in that case the same recordset gets used for
    every record in my main recordset (which is connected to the ppReport) and
    it works...

    I just heard that a new version is available which I am downloading right
    now. Do you think the new version might solve this problem?

    Regards,

    Vincent.


  • edited June 2004
    Unfortunately the update didn't help...

  • edited June 2004

    Do not use the DataSet.AfterOpen and Afterscroll events. That is the
    problem.

    1. Below is an article on linking datasets. Try using one of the techniques
    explained in the article. (The two techniques are mutually exclusive).

    2. In general you should not have any event-handler code that manipulates
    the datasets while the report is executing.

    3. If you need to manually filter the detail dataset, use the master
    DataPipeline OnRecordPositionChange event.




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


  • edited June 2004
    Hi Nard,

    I deleted the subreport and instead used 3 ppDBMemo's since I was only using
    the subreport to create 3 columns. Using the afterscroll seems to be okay
    with this solution.

    Thanks for your help again,

    Vinz.


This discussion has been closed.