INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Formula Help

The reason you can't create a summary field by emcevoy
Posted: 14 Aug 02 (Edited 25 Nov 11)

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).

Cyrstal Reports uses a two-pass reporting process to provide greater reporting capabilities. It is also largely responsble 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?
 
"The function cannot be used because it must be evaluated later"?
 
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 8).

There is this document and many other useful and informative documents regarding crystal reports and evaluation time, functions, formula, crosstabs and much more.

You can find this document at the following address.
http://www.sdn.sap.com/irj/boc/go/portal/prtroot/docs/library/uuid/e055cd62-f91f-2b10-e99d-c5f930a75ca8?QuickLink=index&;overridelayout=true

Hope you find this helpful in your crystal reports development.
Eileen
www.crystalreportsbusiness.com

Back to Business Objects: Crystal Reports 1 Formulas FAQ Index
Back to Business Objects: Crystal Reports 1 Formulas Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close