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 11:11AM
    Use script variable and calculate running total in the band's OnBeforePrint event
  • edited 11:11AM
    gpi wrote: »
    Use script variable and calculate running total in the band's OnBeforePrint event

    Please show me how
  • gpigpi
    edited 11:11AM
    MSantoli wrote: »
    MSantoli wrote: »
    Use script variable and calculate running total in the band's OnBeforePrint event

    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.