Menu

#37 setWhenNoData - Returns blank reports

open-rejected
5
2009-09-30
2009-09-15
Brian Swain
No

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";

Discussion

  • Juan Manuel Alvarez

    thanks for reporting...

    this is really an issue, nobody touch that part of code since long ago...

    which version of DJ are you using?

     
  • Juan Manuel Alvarez

    • status: open --> open-accepted
     
  • Juan Manuel Alvarez

    • status: open-accepted --> open
     
  • Juan Manuel Alvarez

    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?

     
  • Brian Swain

    Brian Swain - 2009-09-16

    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.*" />

    &lt;\!--&lt;parameter name="rightHeader" isForPrompting="false" class="java.lang.String"/&gt;
    &lt;parameter name="leftHeader" isForPrompting="false" class="java.lang.String"/&gt;
    &lt;parameter name="title" isForPrompting="false" class="java.lang.String"/&gt;--&gt;
    &lt;parameter name="bannerPage" isForPrompting="false" class="java.lang.String"/&gt;
    
        &lt;background&gt;
            &lt;band height="0"  isSplitAllowed="true" &gt;
            &lt;/band&gt;
        &lt;/background&gt;
        &lt;title&gt;
            &lt;band height="0"  isSplitAllowed="true" &gt;
            &lt;/band&gt;
        &lt;/title&gt;
        &lt;pageHeader&gt;
            &lt;band height="0"  isSplitAllowed="true" &gt;
    
                &lt;staticText&gt;
                    &lt;reportElement
                        x="8"
                        y="27"
                        width="30"
                        height="4"
                        key="staticText-1"/&gt;
                    &lt;box topBorder="None" topBorderColor="\#000000" leftBorder="None" leftBorderColor="\#000000" rightBorder="None" rightBorderColor="\#000000" bottomBorder="None" bottomBorderColor="\#000000"/&gt;
                    &lt;textElement&gt;
                        &lt;font/&gt;
                    &lt;/textElement&gt;
                &lt;text&gt;&lt;\!\[CDATA\[\]\]&gt;&lt;/text&gt;
                &lt;/staticText&gt;
            &lt;/band&gt;
        &lt;/pageHeader&gt;
        &lt;columnHeader&gt;
            &lt;band height="30"  isSplitAllowed="true" &gt;
            &lt;/band&gt;
        &lt;/columnHeader&gt;
        &lt;detail&gt;
            &lt;band height="100"  isSplitAllowed="true" &gt;
            &lt;/band&gt;
        &lt;/detail&gt;
        &lt;columnFooter&gt;
            &lt;band height="30"  isSplitAllowed="true" &gt;
            &lt;/band&gt;
        &lt;/columnFooter&gt;
        &lt;pageFooter&gt;
            &lt;band height="24"  isSplitAllowed="false" &gt;
                &lt;line direction="TopDown"&gt;
                    &lt;reportElement
                        x="0"
                        y="0"
                        width="729"
                        height="0"
                        key="line-1"/&gt;
                    &lt;graphicElement stretchType="NoStretch" pen="1Point" fill="Solid" /&gt;
                &lt;/line&gt;
                &lt;textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" &gt;
                    &lt;reportElement
                        x="0"
                        y="3"
                        width="74"
                        height="18"
                        key="textField"/&gt;
                    &lt;box topBorder="None" topBorderColor="\#000000" leftBorder="None" leftBorderColor="\#000000" rightBorder="None" rightBorderColor="\#000000" bottomBorder="None" bottomBorderColor="\#000000"/&gt;
                    &lt;textElement textAlignment="Right"&gt;
                        &lt;font/&gt;
                    &lt;/textElement&gt;
                &lt;textFieldExpression   class="java.lang.String"&gt;&lt;\!\[CDATA\["Page " + $V\{PAGE\_NUMBER\} + " of "\]\]&gt;&lt;/textFieldExpression&gt;
                &lt;/textField&gt;
                &lt;textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Report" hyperlinkType="None"  hyperlinkTarget="Self" &gt;
                    &lt;reportElement
                        x="76"
                        y="3"
                        width="100"
                        height="18"
                        key="textField"/&gt;
                    &lt;box topBorder="None" topBorderColor="\#000000" leftBorder="None" leftBorderColor="\#000000" rightBorder="None" rightBorderColor="\#000000" bottomBorder="None" bottomBorderColor="\#000000"/&gt;
                    &lt;textElement&gt;
                        &lt;font/&gt;
                    &lt;/textElement&gt;
                &lt;textFieldExpression   class="java.lang.String"&gt;&lt;\!\[CDATA\["" + $V\{PAGE\_NUMBER\} + ""\]\]&gt;&lt;/textFieldExpression&gt;
                &lt;/textField&gt;
    
            &lt;/band&gt;
        &lt;/pageFooter&gt;
        &lt;lastPageFooter&gt;
                &lt;band height="50"  isSplitAllowed="true" &gt;
            &lt;/band&gt;
        &lt;/lastPageFooter&gt;
        &lt;summary&gt;
            &lt;band height="800"  isSplitAllowed="true" &gt;
                &lt;textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" &gt;
                    &lt;reportElement
                        x="0"
                        y="3"
                        width="250"
                        height="800"
                        key="textField"/&gt;
                    &lt;box topBorder="None" topBorderColor="\#000000" leftBorder="None" leftBorderColor="\#000000" rightBorder="None" rightBorderColor="\#000000" bottomBorder="None" bottomBorderColor="\#000000"/&gt;
                    &lt;textElement textAlignment="Left"&gt;
                        &lt;font/&gt;
                    &lt;/textElement&gt;
                &lt;textFieldExpression   class="java.lang.String"&gt;&lt;\!\[CDATA\[$P\{bannerPage\}\]\]&gt;&lt;/textFieldExpression&gt;
                &lt;/textField&gt;
            &lt;/band&gt;
        &lt;/summary&gt;
    

    </jasperReport>

     
  • Brian Swain

    Brian Swain - 2009-09-16

    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

     
  • Brian Swain

    Brian Swain - 2009-09-17

    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

     
  • Juan Manuel Alvarez

    Then I need to make sure such options are passed to the report AFTER the template is loaded, so they overwite them

     
  • Juan Manuel Alvarez

    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

     
  • Juan Manuel Alvarez

    • status: open --> closed-fixed
     
  • Brian Swain

    Brian Swain - 2009-09-30

    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

     
  • Brian Swain

    Brian Swain - 2009-09-30
    • status: closed-fixed --> open-fixed
     
  • Brian Swain

    Brian Swain - 2009-09-30

    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.

     
  • Brian Swain

    Brian Swain - 2009-09-30
    • status: open-fixed --> open-rejected
     

Log in to post a comment.

Monday.com Logo