The Result Data Newsletter   
Volume 704 - April 2007   
© Copyright 2007 Result Data Consulting, Ltd.  614-505-0770  www.resultdata.com   

    Result Data Home Page  |  Newsletter Archive  |  Upcoming Events  |  Classes & Workshops  |  Request Information
Upcoming Events: 5/2: MOBOUG, 6/6: Microsoft BI Seminar; 7/11: Business Objects Seminar

Return to Newsletter Contents...

 

Understanding Crystal Reports' Report Processing Model

by: Thomas Hinkle, CRCP


Overview:

A good understanding of the process Crystal Reports uses to create a report will help you to design more complex reports and achieve desired results.

Crystal Reports processes a report from top to bottom and left to right. Formulas placed in the top left of the Report Header process first and those placed in the lower right of the Report Footer process last.

Crystal Reports uses a three-pass reporting method to generate reports. The sections below describe what happens during each step of this process. To see a visual representation, refer to the flow-chart at the end of this article.

What is a "pass"?

A pass is a process that Crystal Reports uses each time the data is read or manipulated. Depending on the complexity of the report Crystal Reports may make 1, 2, or 3 passes over the data. This feature allows for complex reporting and formula manipulation.

Pre-pass 1:

When previewing a report, the first elements to be evaluated are "constant" formulas. Constant formulas are those that have a constant value for the entire report. They do not change from record to record. For example, 100* 30 would be a constant formula. Constant formulas are evaluated at the beginning of the print generation process and are never evaluated again. This process is known as "BeforeReadingRecords." If you were to place a constant formula field (i.e., 100*30) in the Details section, the result would be 3000 for each record displayed.

Pass 1:

After the "BeforeReadingRecords" process has taken place, Crystal Reports begins reading the database records. During the record reading process, the following will occur:

  • Record retrieval - Where possible record selection and sorting are pushed down to the database in this step.
  • Evaluation of recurring formulas - These formulas are those that contain database fields but do not contain references to subtotals or summary information. This evaluation time is known as "WhileReadingRecords." Formulas that contain references to subtotals or summary information are processed in the second pass.
  • Application of the record selection locally - If the record selection is too complex to be pushed down to the database, it is applied by Crystal Reports in this step.
  • Sorting, grouping, and totaling - In this step, Crystal Reports sorts the records, separates them into groups, and then calculates the subtotals and summaries needed for each group.
  • Cross-Tab, chart, and map generation - Only Cross-Tabs, charts, and maps that are based entirely on database fields and recurring formulas are generated in Pass 1. If these objects include running totals and/or PrintTime formulas, they are generated in Pass 2.
  • Storage of saved data - After the totaling process is complete, all of the records and totals are stored in memory and to temporary files. Crystal Reports does not read the database again, but instead uses this saved data during all subsequent processing.

Pre-pass 2:

During Pre-Pass 2, Crystal Reports orders the groups in the report for Top/Bottom N or Hierarchical Grouping. The records are not read in this process, instead Crystal Reports only looks at group instances from Pass 1, and takes the Top N as appropriate, or orders the groups based on the Hierarchical Grouping settings specified.

Pass 2:

Crystal Reports enters the second pass through the data to format pages. The pages are formatted on demand. This means that Crystal Reports will not format a page until it is requested by the user, or until it is required for the total page count in Pass 3.

During page formatting, Crystal Reports does the following:

  • Group selection formulas
  • Running totals
  • Calculation of formulas marked "WhilePrinting Records"

These are formulas that contain references to subtotals or summary information, also known as "PrintTime" formulas. This evaluation time is known as "WhilePrinting Records."

  • Cross-Tabs, charts, and maps

Cross-Tabs, charts, and maps that include running totals and/or PrintTime formulas, and charts that are based on Cross-Tabs are generated in Pass 2.

  • OLAP grids 
  • Subreports
  • Generation of Pages on Demand

Note:    Subtotals, grand totals, and summaries may appear to be incorrect if the report has a group selection formula. This occurs because the grand totals and summaries are calculated during Pass 1, but the group selection formula filters the data again in Pass 2. Running total fields can be used instead of summaries to total data in reports with a group selection formula.

Note 2:    Although subreports appear in Pass 2 in the flow chart, you can use on-demand subreports to ensure that your main report remains a single-pass report. With on-demand subreports, Crystal Reports must still make a second pass through the data; however, this second pass does not begin until you drill down on the subreport. Consequently, you can increase the performance of reports that contain subreports by using on-demand subreports.

Pass 3:

In the third, and final pass, the total page count is determined. This applies to reports that use the total page count, or Page N of M special fields.

Multi-pass reporting flow chart:

 

Go to Top  |  Return to Newsletter Contents

The Result Data Newsletter is published approximately once a month to share the latest information on business intelligence, data management and CRM. There should be a link below to allow you to change or remove yourself from our list. We take your requests very seriously. If you have any difficulty please contact us at 614-505-0770 and we will make sure that your request is handled properly. This is not intended to be an unsolicited message and you can reach us in person if needed.

© Copyright 2007 Result Data Consulting, Ltd. - All Rights Reserved
All trademarks and copyrights are the property of their respective owners. This information is provided without warranty.
Announcements
Implementing XI R2 Business Views Class in May
If you need to create Business Views in BusinessObjects Enterprise XI, you need to attend this class.  BusinessObjects XI R2: Implementing Business Views will be held May 21/22 and is guaranteed to run.

Click on the class name to get additional  information or to register.
Next Microsoft BI Seminar
The next free Microsoft BI seminar on is June 7th, 2007.  Call 614-505-0770 or click here to reserve your seat.
Private Training Classes & Mentoring
Ask us about our private classes and mentoring services and how they can help your team get up the curve fast. 
Next MOBOUG Meeting
The next Mid-Ohio Business Objects User Group (MOBOUG) meeting is May 2nd, 2007.  Call 614-505-0770 or click here to reserve your seat.
Looking for a Few Good Men and Women
Join our award winning team of Business Intelligence consultants and .Net Software developers.

Send your resume and salary requirements to:
jobs@resultdata.com