When SCR processes a report, you see the results on the Preview. But in the background, SCR performs many actions in order to collect the records, format them, perform any calculations, and get the report ready for viewing; Seagate Crystal Reports actually “passes over” the report several times before you see the results in the Preview tab. This concept is, sensibly, called mule pass reporting. The ability to pass over the report data multiple times m»w SCR a muclynbre powerful reporting tool.
The Design tab for a report contains many instructions, and some of them must occur after others. For example, if you want to calculate a running tot you must sort the records before calculating the running total. Or, to ca the percent of a subtotal compared to the grand total, the grand total must be calculated first. Then, on its second pass, the report can return to calculate the subtotal percentage.
There arc several passes each time data is read and manipulated.
• Pre-pass #1 or BeforeReadingRecords
• Pass #1 or WhileReadingRecords
• Pre-pass #2
• Pass #2 or WhilePrintingRecords
• Pass #3 ,
During prc-pass #1, or BeforeReadingRccords, SCR evaluates the objects and formulas in the report design and performs any functions or calculations possible before reading any records from the database. For example, a simple formula like 10*2 would be evaluated during this pre-pass.
During pass #1, or WhileReadingRecords, SCR performs the following actions;
• Reads and collects database records
• Evaluates and applies record selection criteria
» Performs sorts, groups, and totaling
• Evaluates recurring formulas
• Creates cross tabs
• Saves work done so far
During pre-pass #2, SCR applies any group sorting or Top N sorting, and hierarchical grouping if this functionality exists in the report design. During pass #2, or WhilePrintingRecords, SCR takes one more look to see if anything still remains to be done. Based on the saved results of pass #1, SCR performs the following actions:
• Calculates totals, like percentage of sum totals or running totals that
must be calculated after pass #1
• Applies the group selection formula, if applicable
• Evaluates any print-time formulas, such as formulas using RecordNumber, GroupNumbcr, Previous or Next functions, or that explicitly use the WhilcPrin gRecords function.