Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: how to separate debit and credit columns Post Reply Post New Topic
Author Message
cross
Newbie
Newbie


Joined: 03 Apr 2007
Online Status: Offline
Posts: 12
Quote cross Replybullet Topic: how to separate debit and credit columns
    Posted: 03 Apr 2007 at 1:54am
Hi All,

I'm writing a report that displays a statement for banking transactions. the report has 3 separate columns, namely for debit, credit, and a running total.  the values for debit and credit are derived from a single field (TRANAMT) and is determined to be a debit when it is < 0 and credit when > 0.


i have written a formula in column 1 (debit) as such : IIF({TRNAMT}<0,{TRNAMT},0)
and in column 2 (credit) as such : IIF({TRNAMT}>0,{TRNAMT},0) so that when TRANAMT < 0 then TRANAMT would be displayed in column 1 (debit), otherwise, column 2 (credit).

the problem is that when the transaction is a credit then the credit column will have the TRANAMT value but the debit column will have a value of 0.  how do i do it so that it will only display for the credit column and *not display anything* for the debit column?

can somebode help me please?

Thanks!
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 03 Apr 2007 at 10:54am
Isn't there a formatting option that lets you display zeros as blanks? You should look around for that setting (I don't remember where it is right now). Another option is to convert the number to text and for the last part of the IIF() statement use "" instead of 0.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 03 Apr 2007 at 10:55am
oh yeah - one more option for you. Use two detail sections. Each one displays the amount in a different column and use your IF THEN statement to determine which one to show and hide the other.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
cross
Newbie
Newbie


Joined: 03 Apr 2007
Online Status: Offline
Posts: 12
Quote cross Replybullet Posted: 03 Apr 2007 at 5:54pm
Originally posted by BrianBischof

Isn't there a formatting option that lets you display zeros as blanks? You should look around for that setting (I don't remember where it is right now). Another option is to convert the number to text and for the last part of the IIF() statement use "" instead of 0.


Hi Brian,

i already tried this but if IIF will not allow "" to be used. 
anyway i tried a different approach by suppressing (Suppress := TRUE) the field depending on the condition and it worked!

i now have a new problem.  below each column is a count to display how many credit and debit transactions there are.  the thing is,  it also counts the suppressed values.  how can i code it so that it will only count the displayed fields?

thanks!
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 03 Apr 2007 at 8:20pm
You need to create a formula with two global variables that track the total number of debits and credits. Within that formula check the whether it is a debit or a credit and increase the appropriate global variable. Then display these two totals under the appropriate column.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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.032 seconds.