running sum

I have 2 fields (ContactPerson & Payment). I want the output as follow:

Date: 01/23/05
ContactPerson Payment TotalAmount
JACKSON 10.00 10.00
JOHN 15.00 25.00
DAVID 5.00 30.00

Date: 01/24/05
ContactPerson Payment TotalAmount
JACKSON 20.00 20.00
MERY 30.00 50.00

how to write code so that the TotalAmount field will have the sum of payment on each date.


Comments

  • gordkgordk St.Catherines On. Canada.
    edited 9:39PM
    create a var and add to it in obp event of detail band 0 it on each group header band.
    ;)
  • edited 9:39PM
    Thank you for replying. You given me a solution but I'm not able to solve it.

    My report has the following band and fields:

    GroupHeader: GroupHeader1 (with only one date field)
    MasterData: MasterData1 (with ContactPerson and Payment field)
    GroupFooter: GroupFotter1


    I had create a variable named totalAmount and drag it to MasterData1 band.
    but what is the code I need to put into onBeforePrint of MasterData1 band?

    Can you give me more detail on how to add the variable to the report & what is the code that I must write in order to sum the Payment in each group.

    Thanks
  • gordkgordk St.Catherines On. Canada.
    edited 9:39PM
    In obp of header
    totalamount := 0;
    in opb of mdband
    [totalamount] := [totalamount] + [tblmame."fieldname"]
    ;)
  • edited 9:39PM
    thank you. I will try it.

Leave a Comment