Cumulative column

edited December 2014 in FastReport VCL 5
Hi,

I am trying to add a cumulative column in the masterdata.

For example,

+-------+--------+-------+---------+------------+
| DATE  | CREDIT | DEBIT | BALANCE | CUMULATIVE |
|-------+--------+-------+---------+------------+
| 10-10 |  0.00  | 10.0  |  10.0   |  10.0      |
| 10-10 |  0.00  | 10.0  |  10.0   |  20.0      |
| 10-10 |  0.00  |  5.0  |  10.0   |  25.0      | 
| 10-10 | 15.00  |  0.0  | -15.0   |  10.0      |
+-------+--------+-------+---------+------------+


Though, when I insert a running total sum, the field disappears. It only works with aggregate functions (for groups, not for lines).

Any thoughts? I know this option was available and very easy to use in QuickReports...

Thanks!

Comments

  • gpigpi
    edited 3:28AM
    Use script variable and calculate running total in the band's OnBeforePrint event
  • edited 3:28AM
    gpi wrote: »
    Use script variable and calculate running total in the band's OnBeforePrint event

    Please show me how
  • gpigpi
    edited 3:28AM
    MSantoli wrote: »

    Please show me how
    var Total: extended;
    procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
    begin
      Total := Total + <Customers."Cust No">                                          
    end;
    
    procedure Page1OnBeforePrint(Sender: TfrxComponent);
    begin
      Total := 0;                        
    end;
    
    begin
    
    end.
    

Leave a Comment