Print Page | Close Window

convert zero to null

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
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=13807
Printed Date: 29 Apr 2024 at 2:11pm


Topic: convert zero to null
Posted By: mjawadkhatri
Subject: convert zero to null
Date Posted: 20 Jul 2011 at 3:46am

i need a formula which convert zero values to null.

thanks




Replies:
Posted By: hilfy
Date Posted: 20 Jul 2011 at 5:18am
Try this:
 
If {table.field} = 0 then null else {table.field}
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: mjawadkhatri
Date Posted: 20 Jul 2011 at 7:18am
i try this
If {@Total} = 0 then null else {@Total}
but not working show error
Plz help



Posted By: hilfy
Date Posted: 20 Jul 2011 at 7:22am
What is the error that you get?

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: mjawadkhatri
Date 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}


Posted By: hilfy
Date 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:
 
mailto:%7b@Total - {@Total } = 0
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: mjawadkhatri
Date Posted: 21 Jul 2011 at 4:05am
Thanks
Working :)



Print Page | Close Window