Click here to Skip to main content
15,885,366 members
Articles / Programming Languages / C#
Tip/Trick

Suppress field in Crystal Reports

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
5 Dec 2012CPOL1 min read 75.4K   4  
Suppress field in Crystal Reports.

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.

Image 1

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. 

Image 2

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.

Image 3

History

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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Systems Engineer
Sri Lanka Sri Lanka
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --