I am creating a report (screenshot is attached below) in which I have to show running total of column Balance
. This balance
column value is generated by adding or subtracting dr
and cr
column value. For more explanation, if dr
is 0
then cr
value will be subtracted from balance
value and if cr
is 0
then dr
value will be added to balance
value, and the balance
column first value will come from particulars (=opening)
column's dr
or cr
value then the calculation will start and running total of balance
will be made.
I have attempted some Crystal Report formulas to accomplish this but failed to get the required values. I have also attached snapshot of my attempted formulas.
First page of report
This image is the formula I used in this report for running total. But this approach is not calculating the correct sum and this formula is not working on next page of report as it starts from the beginning on next page
If anyone knows any other useful and easy way to calculate running total which is suitable in my current situation then please guide me.
You can accomplish it this way. Create two formula fields in report design, namely ff_Reset_Bal
, ff_Cur_Bal
and set their values in formula editor as under:
ff_Reset_Bal
whileprintingrecords;
numbervar RunTotl;
RunTotl:=0;
ff_Cur_Bal
whileprintingrecords;
numbervar RunTotl;
RunTotl:=RunTotl + {WLBills.dr} - {WLBills.cr};
Now place these formula fields in your report as under:
ff_Reset_Bal
in the Report Header Section (its Report Header NOT Page Header)ff_Cur_Bal
in the Details Section (this is your Balance column in report)Now hide ff_Reset_Bal
by Right Click
on it in Report Header, point to Format Field
and then in the Common
tab select Suppress