How To Fix The Endless Printing Loop Bug In Nevrona Rave

- 1 answer

Nevrona Designs'Rave Reports is a Report Engine for use by Embarcadero'sDelphi IDE.

This is what I call the Rave Endless Loop bug. In Rave Reports version 6.5.0 (VCL10) that comes bundled with Delphi 2006, there is a nortorious bug that plagues many Rave report developers. If you have a non-empty dataset, and the data rows for this dataset fit exactly into a page (that is to say there are zero widow rows), then upon PrintPreview, Rave will get stuck in an infinite loop generating pages.

This problem has been previously reported in this newsgroup under the following headings:

  1. "error: generating infinite pages"; Hugo Hiram 20/9/2006 8:44PM
  2. "Rave loop bug. Please help"; Tomas Lazar 11/07/2006 7:35PM
  3. "Loop on full page of data?"; Tony Chistiansen 23/12/2004 3:41PM
  4. reply to (3) by another complainant; Oliver Piche
  5. "Endless lopp print bug"; Richso 9/11/2004 4:44PM

In each of these postings, there was no response from Nevrona, and no solution was reported.

Possibly, the problem has also been reported on an allied newsgroup (nevrona.public.rave.reports.general), to wit: 6. "Continuously generating report"; Jobard 20/11/2005 Although it is not clear to me if (6) is the Rave Endless loop bug or another problem. This posting did get a reply from Nevrona, but it was more in relation to multiple regions ("There is a problem when using multiple regions that go over a page-break.") than the problem of zero widows.



This is more of a work-around than a true solution. I first posted this work-around on the Nevrona newsgroup (Group=nevrona.public.rave.developer.delphi.rave; Subject="Are you suffering from the Rave Endless Loop bug?: Work-around announced."; Date=13/11/2006 7:06 PM)

So here is my solution. It is more of a work-around than a good long-term solution, and I hope that Nevrona will give this issue some serious attention in the near future.

  1. Given your particular report layout, count the maximum number of rows per page. Let us say that this is 40.
  2. Set up a counter to count the rows within the page (as opposed to rows within the whole report). You could do this either by event script or by a CalcTotal component.
  3. Define an OnBeforePrint scripted event handler for the main data band.
  4. In this event handler set the FinishNewPage property of the main data band to be True when the row-per-page count is one or two below the max (in our example, this would be 38). And set it to False in all other cases. The effect of this is to give every page a non-zero number of widows (in this case 1..38), thus avoiding the condition that gives rise to the Rave Endless loop problem.