Solved

Crystal Reports Field Cannot Be Summarized Error

Posted on 2009-04-09
6
1,712 Views
Last Modified: 2012-05-06
When passing a variable from a subreport to the main report, an error is received when trying to Count or Sum this variable from the subreport: This field cannot be summarized when using Count({subreport variable}).  The variable in the subreport does a Distinct Count of employees.
The main report is grouped by employees then by location.  A total of the Distinct Count of employees is need by Location.
0
Comment
Question by:garyjgs
6 Comments
 
LVL 6

Expert Comment

by:namanpatel
ID: 24108656
Count can be used with database field, formula field or array of values. Please make sure you are passing variable of array type.
0
 

Author Comment

by:garyjgs
ID: 24108828
This is the variable passed to the Main Report:
//@SubFormula
//Count of teachers teaching core classes
//{#emp nr distinct ct} field
//Shared variable

WhilePrintingRecords;
Shared numberVar TeachersCoreClassCt := 0;
Shared numberVar TeachersCoreClassCt := {#emp nr distinct ct};
TeachersCoreClassCt

When in the Main Report, this variable TeachersCoreClassCt needs to summed.  
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 24110453
Summary functions are runduring the readingrecords pass through the report.
Shared variables are evaluated later in the generation (printing pass) and thus cannot be used in summaries.

To sum it you will need to have  formulas in the main report to do the summing

In the report header
WhilePrintingRecords;
Global NumberVar TeacherCount := 0;

In a section after the subreport
WhilePrintingRecords;
Global NumberVar TeacherCount;
Shared numberVar TeachersCoreClassCt;
TeacherCount := TeacherCount + TeacherCount;
''

To display it
WhilePrintingRecords;
Global NumberVar TeacherCount;
TeacherCount

mlmcc
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 34

Expert Comment

by:James0628
ID: 24113064
One small, but important, correction to mlmcc's middle formula.  It should read:

TeacherCount := TeacherCount + TeachersCoreClassCt;


 Also, just to clarify, that formula needs to be in a separate section from the subreport, to make sure that it is evaluated after the subreport.  For example, if the subreport is in a Location group footer section, create another Location group footer section below that and put the formula there.  You can suppress the new section.  The formula will still be evaluated.

 James
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 24116847
Thanks James.  Too quick with the paste.

I agree it should be in a later section though if done in the correct order it will work in the same section.  I always do it in a later section to ensure it works since it is too easy to get the order wrong if it is in the same section.

mlmcc
0
 
LVL 34

Expert Comment

by:James0628
ID: 24120408
That's the thing.  I don't know of any way to make sure that the formula is evaluated after the subreport if they're in the same section.

 James
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
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 …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now