Rightclick the field and choose ‘Format’ Go to the tab ‘Common’ Tick ‘Supress’ and click on the formula editor Enter the formula as shown below if {yourtablename.yourfieldname} =0 then true else false
Category: Crystal reports
Setting the zoom level of a crystal report from code
You can set various default zoom levels for your reportviewer, to control how the report is displayed. Create a form with a crystalreportviewer on it, and set the zoom level to the required value. A zoom level of 1 fits the report to ‘page width’ A zoom level of 2 fits the report to show […]
Supressing a group footer based on the number of records in the section
At times you may want to supress a totaling section on your report based on the number of records in the section. In this example, a total for a group is displayed only if there is more then one record in the section. To accomplish this, we need to supress the group footer if there […]
Preventing growing fields from overwriting data lower on the report
Problem : On a crystal reports report, you have a field that can gow quite large, and has ‘can grow’ selected. Hower, when growing it overwrites data lower on the report in the section Solution: Crystal reports fields grow without regard to what’s below it in the same section, you need to create a seperate […]
Getting a named day-of-week from a date field
To get a named “day of the week” in your crystal report, do the following: – Create a new formula field, using the editor – Paste the formula below in, replacing with the name of your report field containing the date [“Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saterday”, “Sunday”] [DayOfWeek({<datefield>})]
Creating a PDF from a crystal report at runtime
The code sample below shows how to create a pdf during runtime from any crystal report. This code assumes you already have a valid report ‘myreport’, if you want an example of how to create a report item from code check ‘ — export report to pdf ‘Imports CrystalDecisions.CrystalReports.Engine ‘Imports CrystalDecisions.Shared Dim s_filename As String […]
Creating a crystal report from an in-memory data table
To use data from an in memory created table object over a direct SQL query has the advantage that you can manipulate the data before it is send to the report, e.a. – you can calculate fields, or remove fields from the dataset before it is passed to the report. Design the report as normal. […]
Binding a string to a textfield on a report at runtime
This sample demonstrates how to display a string in an unbound field on a crystal report. This can be used to display messages which are diffrent depending on runtime parameters during report generation. Private Sub DisplayReport() Dim myreport As ReportDocument Dim freestring As CrystalDecisions.CrystalReports.Engine.TextObject myreport = New ReportDocument myreport.Load() freestring = myreport.ReportDefinition.ReportObjects(“Text1”) freestring.Text = “Your […]
Compare a string field as a date on a report
This formula can be used to compare a string field in a database against the current date and time on a crystal report. Place the formula in the Selection expert / Details. Rows where the date and time contained in the string field falls before the current date and time will be supressed. Note that […]