Solved

Crystal Reports Field Cannot Be Summarized Error

Posted on 2009-04-09
6
1,733 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C# InstallShiled - Multiple Projects 3 61
Basic Crystal Report not showing up on ASP.NET page 4 67
Crystal Reports 2008 6 23
Crystal Report detail 15 37
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 …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

910 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

24 Experts available now in Live!

Get 1:1 Help Now