Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: How to calculate balance brought forward Post Reply Post New Topic
Author Message
Vishakha
Newbie
Newbie


Joined: 01 Feb 2010
Online Status: Offline
Posts: 2
Quote Vishakha Replybullet Topic: How to calculate balance brought forward
    Posted: 03 Feb 2010 at 6:46am
I have to create statement report with debit credit and balance from parameter date say 01/10/2009. for balance i am using below formula
 
shared numberVar rbalance;
IF OnFirstRecord THEN
rbalance := 0 + {@debit} - {@credit}
ELSE
rbalance := rbalance + {@debit} - {@credit} ;
 
Now how should i calculate balance brought forward , that is total(rbalance) of all dates before 01/01/2009 and add this balance as opening balance in above formula instead of 0.
Please help me,
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 03 Feb 2010 at 11:14am
you would need to know the balance brought forward.  If you are not using a stored proc or view, the best option would be to create a subreport (I hate to say that, as the performance suffers) and calculate the balance and then returned via a shared variable.
 
HTH
IP IP Logged
Vishakha
Newbie
Newbie


Joined: 01 Feb 2010
Online Status: Offline
Posts: 2
Quote Vishakha Replybullet Posted: 04 Feb 2010 at 9:55am
Hi
Thanks Lockwelle for your reply.
 
I am not able to get balance from subreport to main report. it is 0 Please help me.
 
I created subreport and balance is calculated in subreport i am writing below formula in detail section
 
shared numberVar rbalance1;
IF OnFirstRecord THEN
rbalance1 := 0 + {@debit} - {@dbcd}
ELSE
rbalance1 := rbalance1 + {@debit} - {@dbcd} ;
 
in Main report - subreport is in Page header and not suppressed
Formula in main report for balance in detail section
 
shared numberVar rbalance;
shared numberVar rbalance1 := 0;
IF OnFirstRecord THEN
rbalance := rbalance1 + {@debit} - {@dbcd}
ELSE
rbalance := rbalance + {@debit} - {@dbcd}


Edited by Vishakha - 04 Feb 2010 at 10:01am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 05 Feb 2010 at 6:27am
well, you are setting rbalance1 to 0, so it is going to be 0.  try creating a formula that just displays the shared variable, just to see if it is getting to the report.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.