Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: How to get a conditional variable to 'stick' Post Reply Post New Topic
Author Message
bigburb
Newbie
Newbie


Joined: 07 Oct 2009
Location: United States
Online Status: Offline
Posts: 26
Quote bigburb Replybullet Topic: How to get a conditional variable to 'stick'
     Posted: 12 Apr 2010 at 9:20am
I'm trying to write a formula to create a variable that tracks the creation date of an order. The purpose is to subtract the creation date from the date the parts are moved to the next operation to get a 'response time' metric.

There are two types of transactions that I have to deal with: C (create/change) and N (next operation). All of these transactions exist on the same table, so I tried setting a variable according to the transaction type:
"global datetimevar creationdate:= if {matltran.trans_type}="C" then {matltran.trans_date};"
I then have a formula that does the math to find the response time as long as there were pieces move to operation 20. The problem I'm having is that the variable resets to 0 if the transaction isn't C, so it doesn't work right if the transaction I'm looking for isn't the next one in the list.

I need to find a way to tell the variable to keep its current value if the trans_type is not C.


Edited by bigburb - 12 Apr 2010 at 10:27am
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 13 Apr 2010 at 1:59am
need to tack an else statement in there.
 
global datetimevar creationdate:= if {matltran.trans_type}="C" then {matltran.trans_date}
     else creationdate;
|< /\ '][' ( )
IP IP Logged
bigburb
Newbie
Newbie


Joined: 07 Oct 2009
Location: United States
Online Status: Offline
Posts: 26
Quote bigburb Replybullet Posted: 13 Apr 2010 at 4:21am
Thanks, that worked. I knew it had to be something simple.
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