Introduction
When implementing a system we are normally inserting default values for the fields in the database rather than inserting NULL
values. But when we are retrieving data from the database and visualizing them from a report, all the default values
come to the report.
Background
To overcome the situation, we can use two methods. One method is mention that default value on a report and consider it as default value to that relevant field.
Using the code
The other method is use the Suppress option given by the Crystal Reports engine. To use that option, first you have to create the report
the normal way. Then select the field you have to suppress and right click on it. Then you have to select Format Object menu item from the popup menu.

Then it will open the Format Editor window which will enable us to do formatting. Now navigate to the Common tab of the window. Now check the Suppress check-box
and click the button in front of the Suppress check box.

The Formula Workshop window will then open.
In here you have to provide a boolean value. Based on it, the value of the field will visible in Crystal Reports. If the provided statement is true, then the field
value will be displayed. If the statement is false, then the field value will not appear.
In this scenario, the default value is 1901/01/01. To suppress this,
I wrote a formula which checks whether the value of the field is 1901/01/01 or not.

History
The original blog post can be found in my blog from this
link.