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

Maximum value of a summary field 1

Status
Not open for further replies.

ramc2000

Technical User
Nov 8, 2002
60
GT
Hi to all experts... I am working on the following report:

GH1: Department

GH2: Employee

D: Number of transactions completed, time elapsed.

GF2: Hidden
Displays the following calculated summary field for each employee: @number_of _transactions_per minute=Sum ({TOT_TRAN}, {EMP_ID})/Sum {ACTUAL_TIME}, {EMP_ID})

GF1: I need to display the emp_id with the highest number of transacctions per minute for this department or at least the actual maximum value. So far everything I've tried has failed. CR won't allow me to insert a summary field for my @number_of _transactions_per minute field neither do a Top N /sort on it.

The report MUST be sorted alphabetically. Any help on how this might be accomplished will be appreciated. Thank you.
 
A quick and dirty method would be to use a formula to maintain the maximum:

@ResetBigOne
BigPlayer := "";
numbervar BigOne := 0;


Alter this:
@number_of _transactions_per minute
numbervar Bigone;
if Bigone < Sum ({TOT_TRAN}, {EMP_ID})/Sum {ACTUAL_TIME}, {EMP_ID})
then
bigone := Sum ({TOT_TRAN}, {EMP_ID})/Sum {ACTUAL_TIME}, {EMP_ID});
BigPlayer := {EMP_ID};
Sum ({TOT_TRAN}, {EMP_ID})/Sum {ACTUAL_TIME}, {EMP_ID})

Now at the GF1 add:

@DisplayBiggie
numbervar Bigone;
stringvar BigPlayer ;
&quot;The big one is &quot;+BigPlayer+&quot; with +totext(Bigone,&quot;,&quot;,2)

Should get ya close

-k
 
Thanks, I did some minor changes but the formulas worked ok:

The reset formula:

whileprintingrecords;
stringvar BigPlayer:=&quot;&quot;;
numberVar BigOne:=0.00;



The employee transactions per hour formula:

If
Bigone<(Sum ({TOT_TRAN}, {EMP_ID})/
Sum ({ACTUAL_TIME},{EMP_ID}))
then (
bigplayer:= {EMP_ID};
bigone:= (Sum ({TOT_TRAN}, {EMP_ID})/Sum
({ACTUAL_TIME}, {EMP_ID});
Sum ({TOT_TRAN}, {EMP_ID})/
Sum ({ACTUAL_TIME}, {EMP_ID})
) )
else
Sum ({TOT_TRAN}, {EMP_ID})/Sum ({ACTUAL_TIME}, {EMP_ID})


And finally:
//display
whileprintingrecords;
numbervar bigone;
stringvar Bigplayer;

&quot;Highest productivity is &quot; + bigplayer + &quot; with &quot; + totext(bigone,2)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top