≡ Menu

Crystal Reports Mutipass Report Processing

Crystal Report uses Multi pass process for report processing. If you are developing a report which has group selection formulas and summaries then its very important for you to understand this process in order to show correct data on crystal report.

Its a 3 pass process which also has Pre-pass steps.

Pre-Pass 1 ( BeforeReadingRecords)

In Pre-Pass1 Crystal Reports evaluates constant formulas. Constant formulas are those which do not have any reference to database records and only includes constants

e.g. 1 + 1

In above formula , there is no reference to any database fields so it gets processes in Pre-Pass1 also call as BeforeReadingRecords.

Pass 1 ( WhileReadingRecords )

In Pass1 Crystal Reports reads data from database and processes it further. Following things will happen in this pass.

  • Crystal Reports reads records from database and except complex record selection formulas Crystal Reports pushes record selection on database side.
  • Evaluation of recurring formula. Recurring formula which does not include any reference to summaries/subtotals and only have reference to database records gets evaluated.
  • Record selection and filtering takes place in this steps.
  • Record selection as per saved data record selection formula
  • Sorting, Grouping and subtotaling as per groups. Summary calculation also takes place in this step.
  • Cross-Tab, Charts and Map processing takes place in this step. If any of Cross-tab, Charts and Maps have reference to Running total summaries it gets processed in Pass 2.
  • Save data in temporary files. Crystal Reports Saves data in temporary files for further processing.

Pre-Pass 2

In this pass , Crystal Reports sorts groups and orders them for Top N,arranges Top-N, Hierarchical grouping purpose.

Pass 2 (WhilePrintingRecords)

This is a Page formatting page where Crystal Reports formats page on Demand. In Pass Crystal Report performs following steps.

  • Apply group selection formula as defined.
  • Calculate Running Total
  • Process charts, Cross-Tab and Maps referring RunningTotal
  • Execute formulas marked as “WhilePrintingRecords”
  • Process sub-reports
  • OLAP Grid processing .
  • On-Demand Page processing.

Pass 3

In this pass Crystal Reports calculates Total Page count for Page N of M., Total Pages etc.

Above Pass Processing is very critical for a report developer in order to debug the report and develop complex reports which has groups, summaries and group filters.

Why Group Summaries are calculated wrong in Crystal Report having Group Selection.

Sometimes if your report has group subtotals , there is a group selection formula in report, then group summaries might appear wrong as group summaries gets calculates in Pass 1 where as Group Selection gets processed in Pass 2. IN order to avoid this always try to use Running Total in instead of Group Summaries or mark your Group Summaries as “WhilePrintingRecords” so that it gets process after Group Selection in Pass 2.

Following example will explain this in scenario in more detail.

In Following report Grand Total of Accounting and Administration department is 24,700.00

When I put the Group Selection Criteria and Select the Accounting as Group then it should show me 20,300.00 as grand total but in actual it shows same value as Grand Total happens in Pass 1  and Group Selection evaluates in Pass 2.

To solve this your can either you can use Running Total or use create a formula for grand total and use WhilePrinitingRecords in it as..

Grand Total:

WhilePrintingRecords;

sum({EMPLOYEES.SALARY},{DEPARTMENTS.DEPARTMENT_NAME})

I hope you enjoyed reading above post do post your experience/questions in the comment box below.

{ 2 comments… add one }

  • Abhishek Kumar December 1, 2012, 11:29 am

    Hello All

    This is Abhishek Kumar, I have got a problem in crystal report that from selection box I have select number of party address and then from command prompt I have to give record number for number of page (that on how many page I have to print the selected records) for the party address.

    With Regards
    Abhishek Kumar

  • Abhishek Kumar December 1, 2012, 11:31 am

    Hello All

    This is Abhishek Kumar, I have got a problem in crystal report that from selection box I have to select number of party address and then from command prompt (that means from next dialog box I have to give record number for number of page to print the selected party address) I have to give record number for number of page (that on how many page I have to print the selected records) for the party address.

    With Regards
    Abhishek Kumar

Leave a Comment