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

How to find Min/Max

Status
Not open for further replies.

jmriddic

Programmer
Mar 7, 2003
10
US
Hi all,

I have 4 fields called presten1,presten2,presten3, and presten4. Since they denote a smilar type value the user wants to find the overall min/max for the fields as a whole.I am having a lot of trouble even trying to come up with a formula to compare each one with another in the instance I am trying to find the minimum.My report is totally written in the report trailer if that helps. Can someone offer a suggestion on how to do this? Thanks.
 
You just need a formula field at the end of your report.

This one does the minimum.

numbervar mymin;
mymin:=minimum({mytable.presten1});
if mymin>minimum({mytable.presten2}) then
mymin:=minimum({mytable.presten2});
if mymin>minimum({mytable.presten3})then
mymin:=minimum({mytable.presten3});
if mymin>minimum({mytable.presten1})then
mymin:=minimum({mytable.presten4});
mymin
 
How about just this in a formula:
Code:
minimum([minimum({mytable.presten1}),minimum({mytable.presten2}),minimum({mytable.presten3}),minimum({mytable.presten4})])

~Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top