Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum a calculated field with v8.5

Status
Not open for further replies.

HKNinja

MIS
Nov 17, 2002
148
0
0
US
hi guys,

I'm trying to sum a formula {@obj}object on my Crystal Reports 8.5 with no luck. I learnt that CR can't sum a formula field. What is the workaround with this? The example is below:

Value: A, B
formula field: @C = A+B
Need: Subtotal of @C column

It's easy to accomplish that in Excel, but don't know how to formula that in CR. Has this improved in later version of CR? Thanks for the help!


- H
 
Yes, of course you can sum a formula in CR. You didn't show your actual formula though, so we can't see what you did. If you had "whileprintingrecords" at the beginning of the formula, remove that.

-LB
 
Right click on the formula field and select the insert option. From there pick grand total or summary. If the insert option is not available, then post your formula as LB suggested.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
Hi guys,

Thanks for the reply. I do not have a formula to calculate this. The formula for @C object is below:

{@AvgPrice}*Sum ({Sales_SalesMix.TotalNumberSold}, {MenuItems.MenuItemName})

This formula yield the total for one line item on Group Header 2. Let say I have 10 line items listed in GH2. What I need is to get a total of @C at Group Footer 1. Am I explaining this clearly? Let me know and thanks for your helps.
 
You can't insert a summary on this because it already contains a summary. Instead, create three formulas:

//{@reset} to be placed in GH#1:
whileprintingrecords;
currencyvar sumC;
if not inrepeatedgroupheader then
sumC := 0;

//{@accum} to be placed in GH#2}:
whileprintingrecords;
currencyvar sumC := sumC + {@C};

//{@display} to be placed in GF#1:
whileprintingrecords;
currencyvar sumC;

If the datatype of {@C} is a number, not a currency, replace all "currencyvar" in the formulas with "numbervar".

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top