Solved

Putting a sum before the details in Crystal Reports

Posted on 2009-06-30
7
348 Views
Last Modified: 2012-05-07
Hi

I am producing a Crystal Report, and need to show the "Total Weight" at the top of the report. However the data for this calculation is in the details that come after it, so the value is not calculated correctly

If i put it at the bottom, after the details, it calculates fine, but that's not allowed for this unfortunately

How can i calculate this correctly and show it in the right position?

Thanks

Scott
0
Comment
Question by:seancurt
7 Comments
 
LVL 2

Accepted Solution

by:
vetaldj earned 500 total points
ID: 24746381
You can create a formula and place it to the Report Header with something like this inside(depends what you need):

WhilePrintingRecords;
Sum(<your field>)

It should works. You can provide what exectly you calculation should do so we can provide you with more accurate formula.
0
 
LVL 22

Expert Comment

by:Ido Millet
ID: 24746597
You are probably using a Running Total.  Change the approach to a conditional total or, if this is not possible in your case, use a subreport.

If you describe the logic of the total it would be easier to address your question.
0
 
LVL 5

Expert Comment

by:dhobale
ID: 24748741
Hi Scott,
You will have to export your report to a table in database and recreate it. Just like creating table of content / index table for crystal report. Without it, you won't be able to display total in header.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 5

Expert Comment

by:dhobale
ID: 24748808
There is an interesting article regarding your question here:

http://kenhamady.com/cru/archives/304

see if it works for you.
0
 

Author Comment

by:seancurt
ID: 24753063
Vetaljd solution has sort of worked, was able to get the sum to show correctly, until i realized i wasn't suming my group correctly. So i changed the sum in my group:-

CDbl (({#TotalQtyGroup}*{@ItemSizeNo})/1000);

to produce a net weight formula.

Now the report won't let me summarize the net weight formula. It says that this field cannot be summarized.:-

WhilePrintingRecords;
Sum({@Net Weight})
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 24759643
Running totals are calculated in the last pass through the report and the value isn't known until the report is complete.   Since the summaries are run in an earlier pass they running totals can't be summarized.

You will have to do a manual summary using formulas and variables.

mlmcc
0
 
LVL 34

Expert Comment

by:James0628
ID: 24769149
What do the {#TotalQtyGroup} running total and the {@ItemSizeNo} formula look like?  It might be possible to change your current formula to something that can be summarized.  That's the only way to get a total based on the data in this report at the _top_ of the report.  You could do a "manual summary", as mlmcc suggested, but if your calculations are based on a running total, you're not going to get your total until the end of the report.

 If you have to use a running total in the calculation, you may have to use a subreport.  You'd put the subreport in the report header and it would read essentially the same data as the main report and produce the total for you.

 James
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

789 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