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

How can I sum a formula 2

Status
Not open for further replies.

dkaf

Technical User
Mar 29, 2005
15
US
My database supplies me with "department code" field, "vehicle number" field, "fuel ticket date" field, "quantity fuel" field, "fuel price" field and "value fuel" field.

The "value fuel" field gives me the transaction total. This is made up of quantiy pumped x fuel cost (fuel cost has 10% added). My database does not give me the cost or the markup as fields. It just gives the transaction total.

I created a formula that give me the cost (@fuel cost). My formula: sum({value fuel, dept code})/1.10

I created a formula that gives me the 10% (@fuel return).
My formula: sum({value fuel, dept code}) - (@ fuel cost)

I now want to do a sum of the {@ fuel cost} and the {@ fuel return}. I want to put these sums in the report footer.

When I do a formula, sum({@ fuel return}) I get "This field cannot be summarized."

How can I summarize these formulas?
 
You can't sum a summary - one of Crystal's little rules. Your own code is slotted into a larger structure, which makes Crystal convenient to use, but also inflexible.

You'll need to begin again and re-do the calculations for the whole report.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
You can summarize summaries, but you need to use variables. Create two formulas:

//{@accum} to be placed in the sectionwhere you have your {@fuelreturn} formula:
whileprintingrecords;
numbervar sumfuelret := sumfuelret + {@fuelreturn};

//{@display} to be placed in the report footer;
whileprintingrecords;
numbervar sumfuelret;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top