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!

Maximum & Minimum on a summary field

Status
Not open for further replies.

LLowrance

Programmer
May 11, 2004
47
US
I'm using CR 8.5 with sql tables
I need to find the maximum and minimum caseload for a set of employees.

I have detail lines for each file then grouping on the employee's login then performing a count on the file's primary key.

Once I get that total for each login I need to know who has the maximum caseload and the minimum caseload.
I've tried running totals but no luck.
Any thoughts?

Output looks like:

Group 1: Office
Group 2: Login
Detail: File detail
Group 2: Login with totals
Group 1: Office with totals with max and min
Grand Totals

Thanks
 
I'm not clear what you're asking. Are you trying to find what the values are? Or which account has them?

If it is a question of identifying the accounts, then choose [Report] and [Sort Records] and put them in caseload order. You could also show the minimum account in the group header and the maximum in the group footer (or vice versa, depending on whether you sort ascending or descending).

Madawc Williams (East Anglia)
 
No once I have the count for each login, I need to know what the max and min is.
Example:

Group 1: Dallas, TX
login1
Detail ClaimantName
Detail ClaimantName
Detail ClaimantName
Login1 Total=3
login2
Detail ClaimantName
Detail ClaimantName
login2 Total=2

Group 1: Dallas,TX=5 MAX=3 Min=2

Thanks
 
You can accomplish this using 4 formulas:

@Init
//place in Group 1 header and suppress it
whileprintingrecords;
numbervar min_login_cnt := 999999999;
numbervar max_login_cnt := 0;

-------------------------------------------------
@Check_Values
//place in Group 2 footer and suppress it
whileprintingrecords;
numbervar min_login_cnt;
numbervar max_login_cnt;

//check min
if count({table.ClaimantName},{table.login}) < min_login_cnt then
min_login_cnt := count({table.ClaimantName},{table.login});

//check max
if count({table.ClaimantName},{table.login}) > max_login_cnt then
max_login_cnt := count({table.ClaimantName},{table.login});

-------------------------------------------------
@Display Min
//place in Group 1 footer
whileprintingrecords;
numbervar min_login_cnt;

-------------------------------------------------
@Display Max
//place in Group 1 footer
whileprintingrecords;
numbervar max_login_cnt;


In your Group 1 Footer, drop a text object there and embed the test you need, plus the Office field and the login counts, and the min and max disply formulas.

~Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top