Tuesday, January 13, 2009

How to make "No Data Found" in Jasper report

Problem:

There's no record found for report, and you want to print "No Data Found" in the report.

Solution:

Solution 3 is the preferred one.

1. Make a dummy empty record for the report so that report display a line in its detail. you can use one of the column to have value of "No Data Found" to solve the problem. you can also make a field that is printed only when dummy record is used.

2. Define a column footer that contains a static text of "No Data Found". make the column footer print only when report count is equal to zero.
Note: in version 2, the column footer is printed at bottom of page. newer version might make it float with column header if there's no body available.

3. Define a report group that groups on nothing. hide the group header. define a static box of "No Data Found" in group footer. make group footer print only when report count is equal to zero.

No comments: