Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Referencing Previous Variable Post Reply Post New Topic
Author Message
candace
Newbie
Newbie


Joined: 12 Jan 2010
Location: United States
Online Status: Offline
Posts: 11
Quote candace Replybullet Topic: Referencing Previous Variable
     Posted: 02 Jul 2010 at 6:37am

Does anyone know if/how you can reference a previous running total variable to be used in a formula on a subsequent record?  I  have a variable running total for Sales for each new opportunity a sales rep closes.  I need to reference that in a formula that calculates commission based on that prior running total value. 

THANKS!
 
My running total variable is:
 
WhilePrintingRecords;
CurrencyVar UserTotal := UserTotal + {amount}
 
The formula field that calculates the commission on a deal is (in part):
 
EvaluateAfter ({@RunningTotal});
Global CurrencyVar D7 :={@RunningTotal}/{Compensation_Rate_Table__c.AAnnual_Quota_New__c};
Global CurrencyVar B7 :={@corrected new amount};
Global CurrencyVar K1 :={Compensation_Rate_Table__c.to_50_Quota__c}/100;
Global CurrencyVar H2 :={@Variable QuotaThreshold};
Global CurrencyVar K2 :={Compensation_Rate_Table__c.to_75_Quota__c}/100;
Global CurrencyVar K3 :={Compensation_Rate_Table__c.to_100_Quota__c}/100;
Global CurrencyVar B6 := ({@RunningTotal});
 
IF Global CurrencyVar B7>Global CurrencyVar H2 and Global CurrencyVar D7<=0.75 then ((Global CurrencyVar ToQuota50- Global CurrencyVar B6)* Global CurrencyVar K1)+(Global CurrencyVar H2*Global CurrencyVar K2)+(Global CurrencyVar B7-Global CurrencyVar H2-(Global CurrencyVar ToQuota50 -Global CurrencyVar B6)*Global CurrencyVar K2) else

IF Global CurrencyVar B7>Global CurrencyVar H2 and Global CurrencyVar D7>0.75 then ((Global CurrencyVar ToQuota50-Global CurrencyVar B6)*Global CurrencyVar K1)+(Global CurrencyVar H2*Global CurrencyVar K2)+((Global CurrencyVar B7-Global CurrencyVar H2-(Global CurrencyVar ToQuota50- Global CurrencyVar B6))*Global CurrencyVar K3)
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 06 Jul 2010 at 3:43am
if the result is not stored in a variable (besides the running total) I am guessing that the answer is NO.  Once you reset the variable, there is nothing to 'see' except its current value.
 
you would probably want to assign the variable the Running Total in a group footer of some sort...or where appropriate...before the Running Total is reset.
 
HTH
IP IP Logged
candace
Newbie
Newbie


Joined: 12 Jan 2010
Location: United States
Online Status: Offline
Posts: 11
Quote candace Replybullet Posted: 06 Jul 2010 at 8:50am
I'm looking to reference the last running total result (or put another way, the running total as of the previous record) within a group (before the running total is reset). 
 
It seems that storing the value of the running total somewhere might enable me to do that, but I'm not sure how to write the syntax that can point to last running total.
 
Any ideas on that?
IP IP Logged
candace
Newbie
Newbie


Joined: 12 Jan 2010
Location: United States
Online Status: Offline
Posts: 11
Quote candace Replybullet Posted: 06 Jul 2010 at 2:01pm

Thanks for reading and your comments.  I realized that I can write a reversal of the running total formula to get the prior running total value. 

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