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

Need to Summerize a Variable

Status
Not open for further replies.

Jamjune

Technical User
Aug 30, 2009
4
US
I am new to using variables.
I have a variable I created from the code below. I need to summarize this field now for the group it is nested in group 1. How can I do that?

Group 2 Variable

WhilePrintingRecords;
Global NumberVar MaxSTDHrs;
if {@SumStdHrs} > MaxSTDHrs then
MaxSTDHrs := {@SumStdHrs};

if Sum ({@CY Tot Hrs}, {ProductivityTemp.EmpID}) >= (MaxStdHrs * .95) then
MaxStdHrs else Sum ({@CY Tot Hrs}, {ProductivityTemp.EmpID})


So for group 1 I need it to add this up for each grp one.

 
You need a reset formula in your group#1 header:

WhilePrintingRecords;
Global NumberVar MaxSTDHrs;
if not inrepeatedgroupheader then
MaxSTDHrs := 0;

Then in the group#1 footer, use this formula:

WhilePrintingRecords;
Global NumberVar MaxSTDHrs;
if Sum ({@CY Tot Hrs}, {ProductivityTemp.EmpID}) >= (MaxStdHrs * .95) then
MaxStdHrs else Sum ({@CY Tot Hrs}, {ProductivityTemp.EmpID})

You don't to specify "global" by the way, as this is the default.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top