Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: If then else ?ignore? Post Reply Post New Topic
Author Message
kmeistering
Newbie
Newbie


Joined: 19 May 2010
Location: United States
Online Status: Offline
Posts: 10
Quote kmeistering Replybullet Topic: If then else ?ignore?
    Posted: 22 Sep 2010 at 3:56am
Hello,

I'm writing an employee position roster report.  I need to sum the field {Main_Data.Enc Sal Amt} when {Main_Data.ID} isnull. 

I wrote the following formula:
if isnull({Main_Data.ID}) then sum({Main_Data.Enc Sal Amt})

but it comes up with zero - and I know the amount should not be zero.  I'm thinking I need an else, but I can't figure out what I should put there!

Please help.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Sep 2010 at 4:39am
you cannot do Conditonal Sums at the aggregate level, but rather you have to do it row by row.
you can either use a Running Total do conditionally sum each row or you can create a formula field to assist called 'Null_ID'.
if isnull({Main_Data.ID}) then {Main_Data.Enc Sal Amt}
then Sum the Formula field
SUM({@Null_ID})
 
RT solution
Name=Null_ID_Sum
field to summarize={Main_Data.ID}
Type=SUM
evaluate=use a formula
isnull({Main_Data.ID})
reset=Never
place in report footer
IP IP Logged
kmeistering
Newbie
Newbie


Joined: 19 May 2010
Location: United States
Online Status: Offline
Posts: 10
Quote kmeistering Replybullet Posted: 22 Sep 2010 at 4:56am
Great, thanks!  That worked!
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.031 seconds.