cancel
Showing results for 
Search instead for 
Did you mean: 

Running totals via 3 formulas - Capturing group totals for use in another formula.

Former Member
0 Kudos

I have successfully created running totals based upon the logic below.

reset --- goes in group header

whileprintingrecords;

numbervar x := 0;

calc goes next to what is being calcualted

whileprintingrecords;

numbervar x := x + {field or formula};

display goes where you would like the value to show

whileprintingrecords;

numbervar x;

x

At the end of each Group, is there anyway to capture the group total for later use?  My report is currently working as follows:

                               Group 1:   Total    500

                               Group 2:   Total  1000

                               Group 3:  Total     600

Report Footer:         Grand Total:  2100

I need to capture Group Total 1:  500, Group Total 2:  1000 and Group Total 3:  600 each separately.

I have a calculation that I need to perform on each Group total but do not know how to capture that number to be able to use  it in another formula.

Thanks for your help.

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Terry,

Here's what you need to do:

1) Create a formula with this code and place it beside the 'calculation' formula:

whileprintingrecords;

numbervar array arr;

numbervar y := y + 1;

redim preserve arr[y];

arr[y] := {@calculation_formula}

2) Now that the array is populated with the group totals, you can create separate formulas to access the values it holds. E.g:

whileprintingrecords;

numbervar array arr[1]; //This will show 500



whileprintingrecords;

numbervar array arr[2]; //This will show 1000


-Abhilash


Former Member
0 Kudos

Thank You!

Answers (0)