Question

I have a report format like

Main Report

Installment # 1

SubReport
---------------
     Group 1 (Suppressed)
        Group 2 Detail 1: 
          ID    Amount (Formula field)
          --   ------- 
           1     100


         Group 2 (Footer)
          ------------
          Total  200
          ------------

         Group 2 Detail 2: 
          ID    Amount (Formula field)
          --   ------- 
           1     300


         Group 2 (Footer)
          ------------
          Total  600
          ------------

Problem I am having is that I am having wrong totals for the formula field in my Group 2 footer (I cannot understand why they are doubled)

I am creating the total field in 2 steps. First I create the variable inside the detail section of Group 2

My formula field for the Amount

WhilePrintingRecords;

EvaluateAfter({@Share_Hundred_Percent});
EvaluateAfter({@Less_Commission});
EvaluateAfter({@Payment_NICL});
EvaluateAfter({@Payment_PRCL});

shared numberVar sumNetPayable;
numberVar result:=0;

if({Command.GENCLIENTCODE}=990) then
    result:= {@Share_Hundred_Percent}-{@Less_Commission} + {@Payment_PRCL}
else
    result:= {@Share_Hundred_Percent} - {@Less_Commission} ;

sumNetPayable := sumNetPayable + result;
result

Then I reset the total field in group 2 footer (but it prints double the amount)

My formula field to display the total

WhilePrintingRecords;
EvaluateAfter({@Net_Payable});

shared numberVar sumNetPayable;
numberVar result:= sumNetPayable;
sumNetPayable :=0;

result

Update

@SilentD. Here is what I found. I deleted both the formulas from the report design view (detail formula+summary). I only placed the Sum Fomula in footer and it works. But when I put the details formula in report the totals are doubled

Was it helpful?

Solution

In the end what fixed my problem was to remove the EvaluateAfter({@Net_Payable}); from my formula field used to display the total in group footer. For some reason it was doubling the calculation.

WhilePrintingRecords;

shared numberVar sumNetPayable;
numberVar result:= sumNetPayable;
sumNetPayable :=0;

result
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top