Archive

Posts Tagged ‘Crystal Error’

Crystal Reports – No Records Error / Splash Screen

September 16, 2011 Leave a comment

There isn’t much more confusing for an end user than facing a blank screen, with no idea if the screen has loaded, caused an error, or frozen.

When writing crystal reports its important to understand that returning no records is a possibility in a lot of cases and this must be effectively communicated with the user on-screen.

No Records Splash Scren Crystal Reports

No Records Splash Scren Crystal Reports

By default, crystal will not display a no records splash screen or display any error messages. It will simply display your Report Header and page headers and the details will be left blank. This could possibly cause issues for the users as they will no be sure as to whether no records have been returned on if there was some sort of error.

In order to create a crystal Report No Records Splash screen, we need to create a report header which will display a message, should no records be returned by the query.

If you have an existing report header such as our fictional “No. Of Products Per Site Report” –  you simply create a second report header.

Right Click on Report Header in design view and select “insert section below”.

This will create a section called “report header b”. This will contain the message you wish the user to see should no records be returned.

We now want to suppress this section of report so that it only displays when we have no records.

Right Click on our “Report Header b” and select “selection expert”. On the common tab, select the formula editor for Suppress (No Drilldown).

In the formula put the following formula

count({Table1.Field1}) <> 0

Ensure that the suppress checkbox is not checked. See image below.
The red Mark on the forumla box shows that a forumla is enetered in the supression criteria.

Suppress Report Header

This formula will mean that the header will not be displayed if the count of your record field does not equal 0 records.

Page Header.

You will also probably want to hide your column headings if there are no records.

To do this, again go to the “selection expert” and tick the “Suppress (No Drill-Down) checkbox and then click on the formula button and enter.

            if isnull({Table1.Field1}) then true

Page Header Suppression

Page Header Suppression

Thats It!

Now when no records are returned you should be able to see the splash screen telling the user that no records are available.