<

[Last Call] Learn how to a build a cloud-first strategyRegister Now

x

The reason you can't create a summary field in Crystal reports

Published on
12,946 Points
6,646 Views
3 Endorsements
Last Modified:
Approved
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples).

Crystal Reports uses a two-pass reporting process to provide greater Reporting capabilities. It is also largely responsible for determining what is and is not possible to do in Crystal Reports.

Understanding this two-pass process will explain many common questions, such as:
1. Why does a formula produce the error?
2. Why am I able to insert summaries on some formulas, but not on others?

3. Why are my grand total and/or summaries incorrect after performing a group selection or Top N/Bottom N sort?

Answers to these questions are:
1. Why does a formula produce the error?

"The function cannot be used because it must be evaluated later"?

Answer: This error usually happens when trying to insert a second pass function into a record selection. Since Crystal Reports evaluates record selection formulas during the first pass of the data, they cannot contain second pass functions.

In general, second pass functions are functions that require data from more than one record. Examples of second pass functions (also known as WhilePrintingRecords or print-time functions) are Next, Previous, TotalPageCount, NextIsNull, PreviousIsNull.

2. Why am I able to insert summaries on some formulas, but not on others?
Answer: Crystal usually evaluates formulas during the first pass of the data. These formulas are known as recurring formulas. However, if the formula contains a second-pass function (these functions are explained in the answer for (1), above), this forces Crystal Reports to evaluate the formula during the second pass instead.

Crystal Reports creates summaries shortly after evaluating any recurring formulas during the first pass. Since SCR has yet to evaluate the second pass formulas, it cannot create a summary for them.

To summarize second-pass formulas, create running totals using variables and the WhilePrintingRecords function.

3. Why are my grand total and/or summaries incorrect after performing a group selection or Top N/Bottom N sort?

Answer: While record selection is evaluated during the first pass, group selection is evaluated in the second pass. Because Crystal Reports creates summaries in the first pass (therefore prior to evaluating group selection), the summaries don't reflect the groups that have been suppressed from the report.

To correctly summarize and/or grand total a report that has a group selection formula, creating running totals, either using variables and the WhilePrintingRecords function, or with the Running Total Expert (available only with version 7 and higher).

Hope you find this article helpful.
Eileen
www.crystalreportsbusiness.com
3
Comment
Author:emcevoy
0 Comments

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Join & Write a Comment

this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Loops Section Overview
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month