Solved

Crystal Reports Field Cannot Be Summarized Error

Posted on 2009-04-09
6
1,755 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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 …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 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