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

TppEngine.GetNextPage - LastPageCached always 0 after FirstPassCompleted

edited September 2012 in General
Hello Folks!

I am struggling with a report I have inherited in Delphi 7 and now
migrated to Delphi XE2 with ReportBuilder 14.06. For most customers the
report works fine but there is one customer where TppEngine.Generate
gets into an infinite loop as it calls GetNextPage. The first pass is
completed (e.g. FirstPassCompleted = True), the AbsolutePageNo = 2 but
the LastPageCached always 0. This causes the AbsolutePageNo to be set
back to 0 too.

You can find a call stack of the situation I am facing here:
http://www.maranatha-consulting.com/Delphi/RB-Infinite-Loop.html

In my case TppReport was asked to print to a PDF file. The report should
have at least 24 pages. The report consists of 59 sub-reports.

What can I do to narrow this down to the data, which is printed into
DBMemo controls that can stretch and why it is only happening for a very
small number of clients?

Salut,
Mathias

Comments

  • edited September 2012
    Hi Mathias,

    Do you see this behavior only with this single report or are there
    others that also demonstrate it? Does this occur when viewing the
    report on screen, printing to a printer, or only when exporting to PDF?

    To narrow down what might be causing the problem, I would suggest trying
    to simplify the report as much as possible. Try removing all (or most)
    event code and see if that helps. If so, periodically begin adding it
    back to isolate the problem. You can also do this with the numerous
    subreports you have. Try setting all of them to Visible := False, then
    periodically toggle their visibility to see if you can isolate the problem.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2012
    Hello Nico,

    Thanks for you reply.

  • edited October 2012
    Mathias wrote:
    Hello Nico,

    I have found the TppDBMemo control that caused the problem. It was
    linked to a field called PhoneContactFrequency of the DataPipeline
    plParent. If I replace that with a TppMemo and assign the
    TField.AsString to the Lines.Text property it is working. Funny enough
    if I use TppMemo.Text := TField.AsString I run into the same infinite loop.

    I bought ReportBuilder Standard, so I can't check what the setter of
    TppMemo.Text does in comparison to TppMemo.Lines.Text. All I know is
    that my DB fields contain CRLFs here and there.

    To avoid an infinite loop if new text is entered into the DB should I
    replace the TppDBMemo controls with TppMemo at least for this sub-report?

    Salut,
    Mathias
  • edited October 2012
    Mathias wrote:
    Hello Nico,

    I am afraid I forgot to set TppMemo.Stretch to True for
    PhoneContactFrequency. If I do so I run into the same infinite loop as I
    did with the data-aware TppDBMemo. In my event handler for the
    particular detail band I now assign a fixed text to the TppMemo.Lines to
    see when it fails.

    ...
    meoPhoneContactFrequency.Lines.Clear;
    meoPhoneContactFrequency.Lines.Add('1st Line');
    meoPhoneContactFrequency.Lines.Add('2nd Line');
    ...

    is fine but

    ...
    meoPhoneContactFrequency.Lines.Clear;
    meoPhoneContactFrequency.Lines.Add('1st Line');
    meoPhoneContactFrequency.Lines.Add('2nd Line');
    meoPhoneContactFrequency.Lines.Add('3rd Line');
    ...

    fails.

    I also tried to replace all CRLFs in the PhoneContactFrequency with the
    text . If I assign the amended string (e.g. 'Text LineText
    Line...') it will work.

    So there must be a setting in the sub-report for PhoneContactFrequency
    that differs form the other PhoneContact* sub-reports. Yet, I haven't
    been able to spot it. I checked for other clients that if their
    PhoneContactFrequency had multiple lines it would print/export to PDF
    fine. All sub-report detail bands have a PrintHeight of phDynamic and
    the chained sub-reports have set their ShiftRelativeTo to the
    predecessor (except for the first one). All TppMemo controls are
    instructed to stretch.

    I really don't know why those PhoneContactFrequency values for this
    single customer causes the report to go into an infinite loop?!?

    Salut,
    Mathias
  • edited October 2012
    Hi Mathias,

    If you try to simplify the report even further by removing all other
    subreports except for the PhoneContactFrequency one, do you still get
    the same behavior?

    Now that you've narrowed down the problem, would it be possible to send
    me a simple example I could run here? Perhaps using TClientDatasets. If
    so, please send the example in .zip format to
    support@digital-metaphors.com and I'll research a solution for you.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.