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

Finding Highest Total in Group

Status
Not open for further replies.

IronRocket

Technical User
Dec 28, 2005
74
US
I've put together two formulas to find out which is the highest order amount per Group. I put one formula in the group header that resets the variable in the coditional formula to 0; and in the group footer, I have an conditional formula that finds the highest order in the group. Unfortunately, this isn't working. It's giving me some other numbers...here is what I have in the two formulas:

In the group header:

Global CurrencyVar OrdersAmount;
OrdersAmount := 0;


In the group footer:

whilePrintingrecords;
Global CurrencyVar OrdersAmount;
DateTimeVar OrdersDate;
StringVar CName;



if {Orders.Order Amount} > OrdersAmount then
(
CName := {Customer.Customer Name};
OrdersDate := {Orders.Order Date};
OrdersAmount := {Orders.Order Amount}
);
OrdersAmount;
 
I think that the second formula should be placed in Details section, and in Group Footer we should have another formula that just displays the result.

-------------------------------------------------------------------------------------------------------------------------
"Now I can look at you in peace; I don't eat you any more." Franz Kafka, while admiring fish in an aquarium
 
Why not use Crystal's built-in Maximum function? If you're not already familiar with Crystal's automated totals, see FAQ767-6524.

[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