Running Total in report

edited October 2011 in FastReport 4.0
I am using below mentioned basic script to get running total in report


Dim RunSum as double

sub Page1OnBeforePrint(Sender)
RunSum=0
end sub

sub DsCustomerLedgerAmount1OnBeforePrint(Sender)
RunSum=RunSum+<DsCustomerLedger."Amount">
end sub


its working fine except variable set from delphi are not received by report


Requirements
1 - can some one tell me how to receive variables from delphi when basic script is being used

2 - what is the equivalent code of above mentioned in pascal script

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 5:15AM
    here is a sample of pascal code for the reports code page.
    var
    RunSum: double; //declare variable type could also be extended
    begin
    masterdata1OnBeforePrint(Sender); // use obp event of mdband
    begin
    RunSum=RunSum+<DsCustomerLedger."Amount">;
    end;
    begin
    runsum:=0; // init variable this code is the first to be processed or use onbeginreport event.
    end.
    in the memoview use [RunSum]
  • edited 5:15AM
    Thanks a lot it worked perfectly

    However for any one else who want to use this code there is just a little correction


    Instead of

    RunSum=RunSum+<DsCustomerLedger."Amount">;

    Use

    RunSum:=RunSum+<DsCustomerLedger."Amount">;


    and thanks for quick help

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.