Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Adding with null values Post Reply Post New Topic
Author Message
debnla
Newbie
Newbie


Joined: 19 Mar 2008
Online Status: Offline
Posts: 1
Quote debnla Replybullet Topic: Adding with null values
    Posted: 19 Mar 2008 at 3:56pm
I'm trying to add field values together to get a total in another field.  The problem is that one of the fields may have null value in it.  When it does, Crystal does not want to add any of the other fields and returns a blank.  What syntax do I use to make Crystal add all the fields regardless if one of them is null?
 
Normally, in MS Access I would use nz.  But obviously doesn't work with Crystal.
 
Thanks for any help in advance.
 
Using Crystal 8.5
IP IP Logged
saoco77
Senior Member
Senior Member


Joined: 26 Jun 2007
Online Status: Offline
Posts: 104
Quote saoco77 Replybullet Posted: 19 Mar 2008 at 4:02pm
One option would be to create a formula along the lines of:

if isnull({table.field}) then 0
else {table.field}

Then preform your calculations on this formula.

Hope this helps.

Sarah
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 19 Mar 2008 at 4:02pm

If it's only one of the fields that may be null, this isn't too difficult:

if IsNull({nullable field} then
  {field1} + {field2}
else
  {field1} + {field2} + {nullable field}
 
-Dell
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.047 seconds.