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

Issue with subreport generation hanging (infinite loop)

edited January 2013 in Subreports
We have an odd issue with a report that has two subreports on it on
RB14.06 and Delphi 2009.

Both subreports contain the same information (the purpose is a bill
where the bottom section tears off to be retained by the payer).

The issue is this: the subreport is fixed and has enough room for 6
items in it. If there are 5 items or fewer then there is no problem. If
there are 7 items or more there is no problem (printing continues on the
next page), but if there are exactly 6 items then the report generation
hangs. I have traced into the code and found that it gets stuck in the
below loop from TppEngine (ppEngine.pas) because the exit conditions are
never met.


while (FBandListIndex <= cPageBandEnd) and not(FPageComplete) and
not(StopPrinting) and
not(lbSectionStarted) do
begin

if (FColumnarReport) and ((FColumnComplete) or (CurrentColumn =
0)) and not(AllDataTraversed) then
begin
FColumnComplete := False;

{generate column headers}
liBandListIndex := FBandListIndex;
liBandIndex := FBandIndex;

StartColumn;

FBandListIndex := liBandListIndex;
FBandIndex := liBandIndex;

{generate group headers}
if (FBandListIndex = cGroupFooterBands) then
GenerateOrphanedGroupFooter

else if (FBandListIndex = cDetailBands) or (FBandListIndex =
cGroupHeaderBands) then
begin
GenerateBands(FGroupHeaderBands, 0, True);

FBandListIndex := cDetailBands;
FBandIndex := 0;
end;

end;

if not(FColumnarReport and FColumnComplete) then
begin
{generate bands in list}
lBandList := FBandLists[FBandListIndex];

GenerateBands(lBandList, FBandIndex, True);

{advance to next band list}
if (not(FColumnarReport) and not(FPageComplete)) or
((FColumnarReport) and not(FColumnComplete)) then
begin
if (FBandListIndex = cPageBandEnd) and
not(AllDataTraversed) then
FBandListIndex := cPageBandStart
else
FBandListIndex := FBandListIndex + 1;

FBandIndex := 0;
end;
end;

Report.ProcessMessages;

lbSectionStarted := (esStartSection in State);
end; {while}



Neither of the two inner IF statements are entered, so the only code run
in each pass of the loop is setting the lbSectionStarted variable, which
of course has no bearing on the loop control.

Do you have any idea what could be causing this? If we alter the height
of the subreport it simply changes how many detail lines are needed to
cause generation to hang. The subreport is Fixed type, TraverseAllData
is true, KeepTogether is false.

All suggestions welcome!

Thanks,

Steve Branley

Comments

  • edited January 2013
    Hi Stephen,

    First, please upgrade to RB 14.07 and re-test. If the problem still
    occurs, please send a simple example demonstrating this behavior to
    support@digital-metaphors.com in .zip format and I'll take a look at it
    for you.

    Best Regards,

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