Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running Total

Status
Not open for further replies.

paljnad

Technical User
Aug 28, 2008
42
US
Hello,

I am using Crystal Reports v 10.0 and I am just not able to think this one out :(

I am displaying credit and debit on a report that has just the detail section. The users want the report to also display a balance field so I wrote a formula:

WhilePrintingRecords;
numbervar balance;
balance := balance + {table_name.AMOUNT}

It displayed the balances OK but now I want to be able to add a month-to-date beginning balance too to the first balance amount.

So my data looks like this assuming beg balance is 10:

Debit Credit Balance

10 20 (debit+beg. balance)
10 10
20 30

So basically, I need the beginning balance to be added only to the first record in the detail section and then just add debit/credit amount.

Please advise.

Thanks !

 
To do this in Crystal you will need to bring back records from the beginning of time so that you can calc balance on opening. Then in report suppress all records before the start date of your report. This will be very slow!!

Alternatively you can build either a stored procedure to create a Balance table, add this to a cron job to build each night or month end to calculate your monthly balances.

Or you could build a view which calculates balances on fly, however, depending on size of your dataset this could be quite slow to execute, but not as slow as doing it in Crystal.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top