setWhenNoData - Returns blank reports
Brought to you by:
djmamana,
martingoros
using the drb.setWhenNoDat(WHEN_NO_DATA_TYPE_NO_DATA_SECTION); or the drb.setWhenNoData("NO RECORDS FOUND", noDataStyle); returns an empty Jasper report with no pages.
The report should contain the report minus the detail section. If the drb.setWhenNoData("NO RECORDS FOUND", noDataStyle); is used it should contain the text "NO RECORDS FOUND";
thanks for reporting...
this is really an issue, nobody touch that part of code since long ago...
which version of DJ are you using?
Hi there, I cannot reproduce the problem.
I run the test ar.com.fdvs.dj.test.WhenNoDataTest and it goes whell with any version the the overloaded method setWhenNoData(...)
can you please describe version of JR, DJ and if you are using a template JRXML?
We are using the newest beta2 jar of DJ.
THis is the JRXML file:
<?xml version="1.0" encoding="UTF-8" ?>
<!--
~ DynamicJasper: A library for creating reports dynamically by specifying
~ columns, groups, styles, etc. at runtime. It also saves a lot of development
~ time in many cases! (http://sourceforge.net/projects/dynamicjasper)
~
~ Copyright (C) 2008 FDV Solutions (http://www.fdvsolutions.com)
~
~ This library is free software; you can redistribute it and/or
~ modify it under the terms of the GNU Lesser General Public
~
~ License as published by the Free Software Foundation; either
~
~ version 2.1 of the License, or (at your option) any later version.
~
~ This library is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~
~ Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public
~ License along with this library; if not, write to the Free Software
~
~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
~
~
-->
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
name="TemplateReportTestPortLandscape"
columnCount="1"
printOrder="Vertical"
orientation="Landscape"
pageWidth="2000"
pageHeight="99999"
columnWidth="729"
columnSpacing="0"
leftMargin="0"
rightMargin="0"
topMargin="20"
bottomMargin="20"
whenNoDataType="NoPages"
isTitleNewPage="false"
isSummaryNewPage="false">
<property name="ireport.scriptlethandling" value="0" />
<property name="ireport.encoding" value="UTF-8" />
<import value="java.util.*" />
<import value="net.sf.jasperreports.engine.*" />
<import value="net.sf.jasperreports.engine.data.*" />
</jasperReport>
It appears the issue is when a template is used. If I remove the template from my code, I get output. Please verify you can replicate this issue.
Brian
DJ,
The issue appears to be that even though I set the parameters for setWhenNoData, the generateJasperDesign code does not set these values if there is a template present.
I would like the ability to have a template with basic desgin but still be able to set the parameters to the DRB.
Also shouldn't there be the ability to have the WhenNoDataAllSectionNoDetail and also display some text??
Regards,
Brian
Then I need to make sure such options are passed to the report AFTER the template is loaded, so they overwite them
Fixed in this version http://fdvs.com.ar/djmaven2/ar/com/fdvs/DynamicJasper/3.0.11-beta4-SNAPSHOT/DynamicJasper-3.0.11-beta4-20090918.034625-1.jar
Note
The following option will be always overwritten by the dynamic report
* number of columns
* When-No-Data behavior
* When-Resource-Missing behavior
* Title start on new page flag (false by default)
* Ignore Pagination flag (false by default)
* Detail Band Split allowed flag (true by default)
* Summary start on new page flag (false by default)
Soon to be GA
djmamana,
I'm now able to see the no data text but the height is very small. I'm unable to insert more than a few lines of text. The page footer, summary etc are removed from a dynamic report and a tempalted report. Seems to be very restricting, is there a way to give the noData band the same flexibility as the Detail etc bands?
Brian
The noDataBand should ahve the similar formatting options as other bands. If the report has a large title section and a page footer and summary section the noData section removes the page footer values and summary section. If you inster more than 4 lines of text into the NoData band the noData band is removed.