Crystal Reports–Show Label if no data exists

Posted by Blake on 1/7/2011
)

One of the base cases anyone using a report tool needs to know is how to show a message telling the user there is no data in the report if nothing comes back in the SQL query for your report of a sub report. Inside of Crystal, we can use a text box with a formula attached to it that will underlay the repeated data elements (which won’t display if there’s no data). You’ll want to put a formula on the “Supress” option of the field and then the text in that field that you want to display. For illustration, I’ll drag the fields next to each other and not overlapping. Right click on the text box that you drag onto the form to get the Format Editor. I will include both Crystal and Basic syntax. I’ve tested this with Crystal Reports 10 and Crystal Reports 2008 (both are still holding up well in 2011).

Crystal Syntax

    not isnull(count({Command.affiliation_desc}))

Basic Syntax

    formula = not isnull(count({Command.affiliation_desc}))