Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Crystal Reports Field Cannot Be Summarized Error

Posted on 2009-04-09
6
Medium Priority
?
1,880 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 101

Accepted Solution

by:
mlmcc earned 2000 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 35

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 101

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 35

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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. …
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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

718 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