?
Solved

Putting a sum before the details in Crystal Reports

Posted on 2009-06-30
7
Medium Priority
?
352 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
[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
7 Comments
 
LVL 2

Accepted Solution

by:
vetaldj earned 2000 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 23

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 101

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 35

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

764 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