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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Summarizing a Formula Result

Status
Not open for further replies.

jakecolman

IS-IT--Management
Apr 2, 2006
54
US
Using Crystal XI with Oracle 9.

I am printing detail records that include three calculated columns: AssetBal, LiabilityBal, and FundingBal. For each row, FundingBal is the difference between AssetBal and LiabilityBal. AssetBal and LiabilityBal are formulas that examine the record and, depending upon various fields in the record, either increment its number variable or leaves it alone. Both formulas use 'whileprintingrecords' in its work.

How do write a formula that can summarize each of these there columns and print/reset the values in a group footer? How do I also print a grand total at the end of the report?

My AssetBal formula (which is very similar to my LiabilityBal formula) looks like this:

whileprintingrecords;
numberVar AssetBal;
if {Command.PRODUCT CLASS} = "ASSET" then
AssetBal := AssetBal + {Command.AMOUNT}
else
AssetBal := AssetBal

Is this the right way to go about this?

Thanks for any help!

...Jake
 
Generally this is done by right clicking a field and select insert->summary->sum and setting it to do so in the group footer, or for the grand total, select grand total(Report Footer).

You can manually create in a formula using:

sum({Command.AMOUNT},{COMMAND.GROUPFIELD})

Or you can subtract two summaries using:

sum({Command.AMOUNT},{COMMAND.GROUPFIELD})-sum({Command.OTHERAMOUNT},{COMMAND.GROUPFIELD})

Or you can use Running Totals.

-k
 
But I don't think you can summarize fields that are calculated within a formula! When I select 'insert summary', the formula is not listed as a summarizable field.
 
You can summarise a formula, if it is based on just a single 'row', the individual records in a detail line. If the formula includes summary values it cannot be summarised.

Please re-read what synapsevampire told you.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top