cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the value of a variable in group footer in the report footer also

former_member357265
Participant
0 Kudos

I have a placed a formula as below at the group footer and the report footer. The data is grouped on the basis of duedays which is again formula and the value in that is appearing correctly.

Whilereadingrecords;

Global Numbervar CNTONE;

Numbervar P := P+1;

IF P = 1 AND {@DUEDAYS} = 0

THEN CNTONE := {spSUPPLIERSOA;1.INVOICEBAL}

ELSE IF P>1 AND  {@DUEDAYS} = 0

THEN CNTONE := CNTONE + {spSUPPLIERSOA;1.INVOICEBAL}

At the group footer I get the value correctly for CNTONE but when I place the formula in Report footer I get the value for CNTONE as 0.

Please do let me know how I could get the same value in the report footer also.

Regards

Sreejith J

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Sreejith,

Change the first line of the above code to:

Whileprintingrecords;


For the Report Footer, create a separate formula with this code:


Whileprintingrecords;

Numbervar CNTONE;


P.S: Since CNTONE is also displayed on the Group Footer, you should also consider resetting the variable so that each new group evaluates the formula starting on the first record. You'll need a reset formula on the Group Header with this code:


Whileprintingrecords;

Numbervar CNTONE := 0;



-Abhilash

former_member357265
Participant
0 Kudos

Hi Abhilash;

When I give the statement whileprintingrecords then my above formula sums up only the first record and the last record of the group and when I give whilereadingrecords it adds up all the data in the group correctly.

The formula that you mentioned for the report footer had worked out and it is showing my result correctly.

I did not put up the reset formula on the group footer because as the group changes I had used another variable in another formula for example for the second group I used

Whilereadingrecords;

Global Numbervar CNTTWO;

Numbervar Q := Q+1;

IF Q = 1 AND {@DUEDAYS} = 30

THEN CNTTWO := {spSUPPLIERSOA;1.INVOICEBAL}

ELSE IF Q>1 AND  {@DUEDAYS} = 30

THEN CNTTWO := CNTTWO + {spSUPPLIERSOA;1.INVOICEBAL}

I have set up total 5 such formulas as the number of groups that will be formed is 5. I have put up these formulas on the group footer and suppressed it as I dont want to get it displayed.

The as you suggested the solution for Report Footer I did that and getting the result correctly.

I dont know I may be following a longer procedure

Take Care

Sreejith J

abhilash_kumar
Active Contributor
0 Kudos

If you place a formula on the Group Header then it can 'see' just the first records in that group. Similarly, the Group Footer can only 'see' the last record in that group.

If you want the formula to evaluate for each record in the group, then you should move you formula to the Details Section.

P.S: A formula marked as 'whilereadingrecords' evaluates in a different pass. With groups, you should always mark such formulae as 'whileprintingrecords' to avoid incorrect results.

-Abhilash

Answers (0)