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

Sum Group 2 Based on Maximum of all Group 1 1

Status
Not open for further replies.

mdl2

Programmer
Apr 12, 2002
25
0
0
CA
Can you process a running total sum (of the maximum of group 1 ) for group 2

i.e

voucher
123a 10000
123a 5000
max 10000

124b 30000
124b 50000
max 50000

we want a result of 60000
 
yes create a formula and pass the end result of group 1 and total it in a separate counter formula for your report footer.
 
Create three formulas:

//{@reset} to be placed in the group #1 header:
whileprintingrecords;
numbervar summax := 0;

//{@accum} to be placed in the group #2 footer.
whileprintingrecords;
numbervar summax := summax + maximum({table.amt},{table.voucher}); //where {table.voucher} is your group field

//{@display} to be placed in the group #1 footer:
whileprintingrecords;
numbervar summax;

This will give you a sum of the maximums of group #2 for your outer group #1. You were using the terms for groups in an unusual way. Group #1 is your highest level group, group #2 is nested within Group #1, so I assumed you meant you wanted to sum the maximums for group #2 at the group #1 level. If what you really want is a report total, then you don't need the reset formula, and you would place the display formula in the report footer.


-LB
 
LB

Your formulas worked perfectly for a problem I was having. My problem goes one step futher. You mentioned to mdl2 how to handle just a report total.

I need a total of the max totals. Can this be incorporated with what you have already suggested?

Ray
 
To have both group and report totals in the above situation, you would add a variable to the detail formula:

//{@accum} to be placed in the group #2 footer.
whileprintingrecords;
numbervar summax := summax + maximum({table.amt},{table.voucher});
numbervar grtotmax := grtotmax + maximum({table.amt},{table.voucher});

Then use a display formula in the report footer:
whileprintingrecords;
numbervar grtotmax;

Because there is no reset formula, it continues to add across groups.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top