开发者

"No data found." text in Jasper Report

I would like to do the report开发者_如何学Go using iReport which can but does not have to display rows. How can I force Jasper Reports to display the text "No data found." when the query returns no data. I would like to have the same header as when there are rows.

I know I should change the report property "When No Data" to display something but I don't know how to implement the condition for no rows.


I have found it out myself.

This could be done by following these steps:

  1. Add the "No Data" section from the sections list in the "Report Inspector". Right click it and choose "Add Band". After this, new section will be added to your report.
  2. Add any content to the new added section, e.g. "No Data found." message (if you would like the same header as in "normal" report, you have to copy it from the "Header" section to "No Data" section).

If you don't have the report property "When No Data" set to "No Data Section" set it so or follow these steps:

  1. Display report property by right clicking on the report and choosing "Properties" from the displayed menu.
  2. Find the section "More..." and in it you will see "When No Data" property, change it to "No Data Section".

After following the above, your report will show the "No Data" section when there will be no data, oterwise it will show the section as before.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜