Jump to content
We've recently updated our Privacy Statement, available here ×
  • "Do not send emails for empty reports" - how to make it work with 'No Data' band printed in the report output


    Dhiraj Pahlani
    • Product: JasperReports® Server

    Problem:
    Scheduled emails are being received for empty reports with 'No Data' band printed in the report output, even when the 'Do not send emails for empty reports' option is ticked at the time of schedule creation.

    We are adding a message in the 'No Data' band if the report doesn't result in any data. Looks like Jaspersoft is considering 'No Data' as data and not considering report as empty.

    No Data message used in our JRXML reports:
    The specified criteria didn't result in any data. This is often caused by applying filters and/or selections that are too restrictive or that contain incorrect values. Please check your Analysis Filters and try again.


    Cause:
    From JasperReports Library perspective, the report is not empty because it actually contains a page with elements. It displays something. But they are empty from an end user perspective, because they do not contain any useful information. Note that from the program perspective, we cannot say if a report is empty, if it actually contains some elements on a page. We have to be told it is empty, from a logical perspective, because we cannot asses this programmatically.

    Solution:
    As discussed above in the cause, from the program perspective, we cannot say if a report is empty, if it actually contains some elements on a page. We have to be told it is empty, from a logical perspective, because we cannot asses this programmatically. The custom property - com.jaspersoft.jrs.export.report.empty - can be used for this purpose.

    Set below property at report level to have the scheduler not send emails for reports with 'No Data' message:
    <propertyExpression name="com.jaspersoft.jrs.export.report.empty" evaluationTime="Report"><![CDATA[boolean.toString($V{REPORT_COUNT} == 0)]]></propertyExpression>

    Please find the test noData.jrxml report attached for reference.

    Further read:


    "Do not send emails for empty reports" - how to make it work when sub Dataset is empty
    https://community.jaspersoft.com/wiki/do-not-send-emails-empty-reports-how-make-it-work-when-sub-dataset-empty
    ______________________________________________________________________________________________________________________________________________________
    Ref. Case #02103408

    nodata.jrxml


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...