I am in an urgent need of having the print layout thing based开发者_StackOverflow社区 on the one fied condition. Let us say I have a shipment label layout with 50 fields in it and which is working. But before I print that, I have a condition saying that if Number of Packages is 0 do not print at all. Just print an error message saying that no packages and no labels. Which means when that particular actions is taken, if the number of packages is 0 then it should print only a message and not the total print layout with 50 fields.
Anythoughts, I went through lot of documentation. I found only print when expression is used at field level. if that's case do I need add that check for all the 50 fileds :).
Please clarify or suggest.
Regards, ~Madhu
did u meant u dont want to display the report page if there is no data? If that case, u just have to go to report propeties, then at the "more" band, you change "when No Data Type" to No Page.
The program might query with
SELECT COUNT(*)
before running the report. If the count is zero, then the program shows the message; otherwise, it will shows the report.Get the list of pages from
JasperPrint
. The list size is the number of pages.JasperPrint print; print = JasperFillManager.fillReport(filename, map, connection); List list = print.getPages(); System.out.println(list.size());
精彩评论