“The Report is empty” - is bug?

2019-02-28 13:10发布

问题:

I've created report with 3 parameters in iReport and it's running successfully. The report is execute MS SQL stor proc with 3 parameters:

  1. startdate;
  2. enddate;
  3. dept_nm (department name);

iReport gives good result. As soon as I exported jrxml file to JasperReports Server 4.1 I have message "The report is empty".

In the Repository under JasperReports Server I've created controls for dates parameters and single list values for dept_nm parameter.

Do you know how to debug and trace this message coming from???

回答1:

Your query is returning no data. The message appears when the report result is null.

The quickest way to debug this in JasperReports Server is to modify the report's behavior when no data is returned. The default behavior is "No Pages". Change it to "All Sections, No Details". That way you'll get at least the report title and summary band.

Display your parameters in the title band to see what their values are. Often they aren't what you expect. For example, your input control is "StartDate", but your parameters is "startdate". So the parameter doesn't get the value you thought it would.



回答2:

Maybe you did not connect your report to any Data Source.



回答3:

I get this a lot. E.g if you have sub reports only, it thinks the main report is blank. You have to do something silly like insert a dummy SQL into your report such as "select 1" then populate a hidden part of the report with the result. When it works on in report studio, but gives you the report is empty on the server (with a good data source - other reports working) is when you have real trouble. Not solved those yet.