Search code examples
jasper-reportsjasperserverjaspersoft-studio

Why Jasper Reports shows empty report in server, but generates correctly in jasper studio


I am using Jasper Studio 6.6.0 and Jasper server 7.1.

I have created a simple report with an image from a specified URL.

It generates correctly in Jasper Studio, but in the server it shows empty.

Please refer images attached:

Server Screenshot server screenshot Jasper Screenshot jaspersoft screenshot


Solution

  • If you want to show something in the JasperReport without data source or with empty data source then you have two options:

    1) Set the When No Data Type property on All Section No Detail option in the Jasper Studio: When No Data Type

    In JRXML it can be done by setting whenNoDataType="AllSectionsNoDetail" attribute on the root <jasperReport> element.

    2) Or you can move content you want to show when there is no data into No Data band of the report: No Data Band

    In JRXML it it can be done by adding of this:

    <noData>
        <band height="110">
            <image>
                <reportElement x="0" y="0" width="240" height="110" uuid="d4b9e59b-896e-4881-92a2-c6707c975312"/>
                <imageExpression><![CDATA["https://my.image.url/getImage?name=penguin"]]></imageExpression>
            </image>
        </band>
    </noData>
    

    JasperReport renders blank page when there are no data as a default and JasperServer shows The report is empty, so select from above options one you prefer to be able to show the image you want.