Print There is no data set for an empty data set

I have a report that has a dataset in it. I want to print No Data Band when a query in a dataset returns 0 records (empty dataset).

I set "When No Data" to the "No Data Section". But it doesn't seem to work.

Any suggestions?

+6
source share
2 answers

To print No data range when a query in a data set returns 0 records (empty data set), follow these steps: -

  • Go to Report Inspector and add No Data to the report.
  • Put static text e.g. No data
  • Right-click a report to open the report properties section.
  • Set the property When there is no data for No data section

After adding a data range, when the query returns 0, the entry β€œNo data” will display static text.

+9
source

For people like me who don't use JasperSoft or older iReport and work directly with XML, follow these steps:

<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" whenNoDataType="NoDataSection" name="freport" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> 

Add whenNoDataType="NoDataSection" to the <jasperReport> element.

 <noData> <band height="15"> <staticText> <reportElement x="0" y="0" width="200" height="15"/> <box> <bottomPen lineWidth="1.0" lineColor="#CCCCCC"/> </box> <textElement /> <text><![CDATA[The report has no data]]> </text> </staticText> </band> </noData> 

Add the <noData> element below the part range.

0
source

All Articles