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

find maximum of formula output 1

Status
Not open for further replies.

mollyk

Technical User
Nov 10, 2004
2
US
I am somewhat new to CR, but was able to create a formula successfully. the problem is I would like to find the maximum of the values found in that formula.
When I go to summarize, the @ variable is not listed. any ideas? here is my formula:

Code:
whileprintingrecords;
numbervar prev;
numbervar current;
numbervar formula;
prev:=previous({history_112004.inVal});
current:={history_112004.inVal};
if (prev=0 or (prev>current))
then formula:=0
else formula:=current-prev;
 
Create these formulas:

//{@max} to be placed in the details section:
numbervar formula;
numbervar max;

if onfirstrecord or
formula > max then
max := formula;

//{@displmax} to be placed in the group or report footer:
whileprintingrecords;
numbervar max;

If you are using a group, then you would want to reset the variables by placing the following formula in the group header:

whileprintingrecords;
numbervar prev := 0;
numbervar current := 0;
numbervar formula := 0;
numbervar max := 0;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top