JasperReport define 4 possible actions when the data source is empty. These actions are described below.
Using the DynamicReportBuilder
DynamicReportBuilder setWhenNoDataType(byte whenNoDataType)
These convenient methods are also available:
setWhenNoDataNoPages(), setWhenNoDataBlankPage(), setWhenNoDataAllSectionNoDetail() and setWhenNoDataShowNoDataSection()
Whe can also define a text to be shown when the data source is empty. Using the DynamicReportBuilder we can do like this
DynamicReportBuilder setWhenNoData(String text, Style style)
or this
setWhenNoData(String text, Style style, boolean showTitle, boolean showColumnHeader)
In the first call, by default the title and column header are also shown along with the "No data for this report" text.
In the second call we can choose independently to show or not the title and column header.
| Test | Description |
| ar.com.fdvs.dj.test.WhenNoDataTest | Creates a simple report using an empty list as data source |