Print Page | Close Window

How to convert 0 to null value?

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=22546
Printed Date: 27 Apr 2024 at 11:30am


Topic: How to convert 0 to null value?
Posted By: mh9876
Subject: How to convert 0 to null value?
Date Posted: 12 Feb 2018 at 6:41am
I am trying to display the 0 value as null. I don't want to suppress it because I'm using a background color for that entire row and don't want a white space (which appears if I suppress the value 0).

In the field formula I have the following code, but it's not doing any thing and would still display 0.
My field is NUM_DATA_02. @Blank is a formula with '' in it.

If {Command.NUM_DATA_02}=0 OR IsNull({Command.NUM_DATA_02}) Then val({@Blank}) Else {Command.NUM_DATA_02}

I even try the following code to specifically mention which record number, but that's not working either.

If RecordNumber = 7 and {Command.NUM_DATA_02}=0 OR IsNull({Command.NUM_DATA_02}) Then val({@Blank}) Else {Command.NUM_DATA_02}

Any help is greatly appreciated!



Replies:
Posted By: mh9876
Date Posted: 12 Feb 2018 at 7:36am
I have the following formula in "Display String" under common tab. This works but it changes my numeric field to text and I cannot format it with decimals and percent sign.

IF RecordNumber in [7, 14] Then ToText({@Blank}) Else ToText({@Numeric Data 02})



Print Page | Close Window