views:

280

answers:

0
Crystal Reports seems to have an 80 section per group limit

Environment:
  Microsoft Windows XP
  Professional
  Version 2002
  Service Pack 3

  Crystal Reports XI (Release 1)
  Calling the Crystal Reports Engine crpe32.dll version 11.0.0.1445
  Via Crystal VCL 11 libraries
  Via Borland C++Builder 6 Enterprise Suite Version 6.0 (Build 10.166)

I found the report containing 86 sections (in one group)
ran just fine using the Crystal Reports XI exe found at
C:\Program Files\Business Objects\Crystal Reports 11\crw32.exe

However, when I called the same report from an executable compiled 
using Borland C++Builder -> VCL calls -> crpe32.dll
IT DID NOT PRINT.

I spent many frustrating hours debugging the exe.
I used the divide and conquer debugging approach and devised 
a state machine that would do the following while logging every
state along the way: 
1. Load the Engine via LoadEngine;
2. Open the Engine via OpenEngine;
3. Open the PrintJob via OpenJob;
4. Close the PrintJob via CloseJob;
5. Close the Engine via CloseEngine;
6. Unload the Engine via UnloadEngine;
I found that the report errored out at OpenJob
with Crpe1->Status() status "crsJobFailed"
Crpe1->LastErrorNumber was "505: No print destination specified"

Here's the play by play (I output this to a file):
  LoadEngine() started
  LoadEngine() completed. The handle to CRPE32.DLL is: 728956928
  EngineOpen() started
  EngineOpen() completed. Engine is already opened.
  JobIsOpen() started.
  JobIsOpen() completed. The PrintJob is open.
  Execute() started
  Status() crsJobFailed
  Execute() failed.
  Error state.
  LastErrorNumber 505: No print destination specified.
  C:\REPORTS\ProblemReport.rpt
  Please first call PEOutputToWindow or PEOutputToPrinter!
  Execute 
  Finished state.

Back to the report:

Deleting some /*comment*/ sections from the report brought the number of
sections down to 78 and voila ... the report printed out just fine from the
executable compiled on Borland C++Builder -> VCL calls -> crpe32.dll

My conclusion:
Avoid creating over 80 sections in a group.

As a workaround, you can add another group having 
the same GROUP BY column (essentially, repeat the 
same group) and create all the extra sections needed 
in the new group (the repeated group).

It's the equivalent of writing the following SQL
SELECT 
   column1
   column1
FROM table
GROUP BY 
   column1,
   column1;

Has anyone else had this problem?
If yes, what solution have you devised?