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

Performing Summary's on formula's 1

Status
Not open for further replies.

leiela

Programmer
Dec 14, 2007
15
GB
Ok what i have is something like this,


GH1 - name, Max(@cost)
Details(suppressed) - name, @cost

I have to use the a formula to pull the "cost" from the database because there are many types of costs in the database and im only interested in one kind.

And each item may have many of this type of cost assigned to them, i don't need to see all these as im only interested in the "max cost".

I've used a summery to pull the max out of the details and put that value in the group header, and ive suppressed the details sections containing the un-needed data.

However I now need to do a "sum" on these Maxcosts and it won't let me perform one on a summery field.

Any idea's??
 
Crystal can't total totals. Do the grand sum from the detail level instead of from the group summary level.

The other alternative is to use a variable to accumulate the values in the group level. Looks like the simpler 1st approach would work in your case.

- Ido

view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Won't a grandtotal on the detail level add up all of the values? i specifically only want it to add up the "max cost" for each item.

Example.

GH - Tin of Beans - 50 <---- Max of details

Details - Tin of Beans 30
Details - Tin of Beans 30
Details - Tin of Beans 50
Details - Tin of Beans 20
Details - Tin of Beans 10

GH - Carrots 80p

Details - Carrots 50p
Details - Carrots 70p
Details - Carrots 80p

Total - £1.30p

Because its only added up the "max value" of beans and the "max value" of the carrots. Not every line in the details section.




 
Create two formulas:

//{@accum} to be placed in the group header:

whileprintingrecords;
numbervar summaxamt := summaxamt + maximum({@cost},{table.item});

Then in the report footer, use this formula:

whileprintingrecords;
numbervar summaxamt;

If {@cost} is a currency, not a number, change the variables to currencyvar.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top