[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Calculating a running balance



Adam,
In ReportBuilder, define your report as usual.  I'm assuming you have a
group break, such as "Account".  In the detail section, insert a new
variable ("Insert Field Button">Variables tab>"New Variable").  Call the
variable Balance (if you want), set the type to numeric, and then set the
definition to #Balance + <drag the debit/credit field into this space>.  Hit
"Insert", "Close", then "Insert", "Close".  You then need to look at the SQR
generated, which will have a "BeforeACCT" or some such name procedure for
processing before the Acct is printed.  Go to the first available ">" after
"Begin-procedure" and hit the "Enter" key.  Type in "move 0 to #Balance".
This statement is needed to reset the balance after every break.  Because
you entered the statement with the SRM open, it will be kept if you make any
further changes to the layout.

Hope this helps,
Stan

-----Original Message-----
From: Adam Harborow [mailto:adam.harborow@ZURICH.COM]
Sent: Monday, February 19, 2001 9:22 AM
To: SQR-USERS@list.iex.net
Subject: Calculating a running balance


Hello

I am using BRIO Report builder 6, Windows NT 4.0, Oracle 7.3.4.

I am trying to compile a report that takes the form similar to a bank
account statement.  I have a starting balance and an end balance but I also
have numerous transactions (debit/credit column) that occur between the
start and end balance.  What I need to do is have a running balance (under
the heading balance) of the different transactions eg:

debit/credit       Balance
                              100 (starting balance)
-50                          50
 200                       250
100                        350
-150                       200
                               200 (end balance)

Basically I have the debit/credit data and the start/end balance.  I just
need to create a running total balance.  I need a good starting point hence
the lack of any code.

Thanks in advance

Adam