Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: using IF ELSE to separate data in a field Post Reply Post New Topic
Author Message
cold_witt
Newbie
Newbie
Avatar

Joined: 16 Mar 2010
Location: United States
Online Status: Offline
Posts: 3
Quote cold_witt Replybullet Topic: using IF ELSE to separate data in a field
     Posted: 13 Apr 2012 at 8:35am
I have a field {COST} that has both negative and positive numbers.  I would like to separate that field into two columns - DEBIT and CREDIT.  I'm guessing I can use an IF/ELSE statement such as
IF {COST} <0 then {CREDIT} ELSE {DEBIT}
 
Is it possible to take data from a field and sort it out this way?  Would I need to set up two fields in my View first called Credit and Debit to store the data?
 
Thanks for the help!
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 15 Apr 2012 at 2:34pm
You can do this in the report.  You would create two formulas - one for credit and one for debit.  Credit would look like this:
 
If {COST} > 0 then {Cost} else 0
 
If you don't want to show 0 when this is a debit, take out the "else" part of the formula.
 
-Dell
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