Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: convert zero to null Post Reply Post New Topic
Author Message
mjawadkhatri
Newbie
Newbie
Avatar

Joined: 09 Sep 2009
Location: Pakistan
Online Status: Offline
Posts: 14
Quote mjawadkhatri Replybullet Topic: convert zero to null
    Posted: 20 Jul 2011 at 3:46am

i need a formula which convert zero values to null.

thanks

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 20 Jul 2011 at 5:18am
Try this:
 
If {table.field} = 0 then null else {table.field}
 
-Dell
IP IP Logged
mjawadkhatri
Newbie
Newbie
Avatar

Joined: 09 Sep 2009
Location: Pakistan
Online Status: Offline
Posts: 14
Quote mjawadkhatri Replybullet Posted: 20 Jul 2011 at 7:18am
i try this
If {@Total} = 0 then null else {@Total}
but not working show error
Plz help

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 20 Jul 2011 at 7:22am
What is the error that you get?
IP IP Logged
mjawadkhatri
Newbie
Newbie
Avatar

Joined: 09 Sep 2009
Location: Pakistan
Online Status: Offline
Posts: 14
Quote mjawadkhatri Replybullet Posted: 20 Jul 2011 at 9:27am
Error is
A number, currency amount, boolean, data, time,date-time or string is expected here

If {@Total} = 0 then null else {@Total}
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 20 Jul 2011 at 9:56am
Ok.  So what are you trying to accomplish?  Do you just want nothing to appear on the report if a number is 0?  If that's the case, instead of converting to null, you'll conditionally suppress the object on the report.
 
Right-click on the object, select "Format...".  On the Common tab, click on the button to the right of the word "Suppress" (DO NOT check the checkbox!)  Enter the following in the formula:
 
{@Total} = 0
 
-Dell
IP IP Logged
mjawadkhatri
Newbie
Newbie
Avatar

Joined: 09 Sep 2009
Location: Pakistan
Online Status: Offline
Posts: 14
Quote mjawadkhatri Replybullet Posted: 21 Jul 2011 at 4:05am
Thanks
Working :)
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.