Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Opposite of Running Total? Post Reply Post New Topic
Author Message
Stingerfreak
Newbie
Newbie


Joined: 03 Dec 2009
Location: United States
Online Status: Offline
Posts: 6
Quote Stingerfreak Replybullet Topic: Opposite of Running Total?
     Posted: 03 Dec 2009 at 9:52am
I can't think of a better way to put it, and that's probably why my online and text searches aren't returning any results.
 
Essentially, I have one currency field in a group header that I need to draw down on for each record in my Details section, with the balance carrying forward so that each record subtracts not only its own value, but includes all previous records' values, as well.  So, the opposite of a running total, in that, instead of the number gradually increasing, it gradually decreases.  The best example I can think of is your bank statement, where each transaction deducts itself from the balance of your account as of the previous transaction.
 
I know there's a super easy way to do this, but my brain isn't functioning well enough to remember it, and I would greatly appreciate any help anyone out there could offer.
 
Thanks in advance!
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 Dec 2009 at 10:43am
if it is just math...I don't use running totals (CR's running totals), but I create shared variables (numbervar) in this case and do my math as I want on the variables and then display them.
 
Is this what you were looking for?
IP IP Logged
Stingerfreak
Newbie
Newbie


Joined: 03 Dec 2009
Location: United States
Online Status: Offline
Posts: 6
Quote Stingerfreak Replybullet Posted: 03 Dec 2009 at 11:02am
I'm not sure.  I've never used shared variables.  Would that accomplish what I want to do?  And is that a function, or an operator?  How do you "do your math" on the variables?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 Dec 2009 at 1:16pm
a variable comes in 3 types
 1) local, can only be 'seen' in the formula
 2) global, can only by 'seen' in the current report
 3) shared, can be seen in both a subreport and the current report
 
A variable, is just that, so if you chose a numbervar, there a 'place holder' for your values.  The report would need to initialize the variable from somewhere (I am assuming from the database, but it doesn't need to be).  As for math, you said an analogy is the bank statement, so at some point it is set to the current balance (usually the initialization is in the group header, but it might be the report).  The variable is incremented (usually in details) and in your case the incrementing would be to subtract the value from your variable. Finally the variable is displayed, this might be in details and/or group footer.
 
Does this help?
IP IP Logged
Stingerfreak
Newbie
Newbie


Joined: 03 Dec 2009
Location: United States
Online Status: Offline
Posts: 6
Quote Stingerfreak Replybullet Posted: 04 Dec 2009 at 8:48am
If I'm being honest, it's all rather confusing.
 
But you've given me something to go on, so I'm going to read up more on the variable section of the manual and hopefully I can make it work from there.
 
I appreciate your help!
IP IP Logged
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