Solved

Putting a sum before the details in Crystal Reports

Posted on 2009-06-30
7
342 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

757 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

20 Experts available now in Live!

Get 1:1 Help Now