Print Page | Close Window

If then else ?ignore?

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=11170
Printed Date: 03 May 2024 at 11:45pm


Topic: If then else ?ignore?
Posted By: kmeistering
Subject: If then else ?ignore?
Date 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.



Replies:
Posted By: DBlank
Date 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( mailto:%7b@Null_ID - {@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


Posted By: kmeistering
Date Posted: 22 Sep 2010 at 4:56am
Great, thanks!  That worked!



Print Page | Close Window