File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes Jasper Reports Cookbook - One More Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Jasper Reports Cookbook - One More Question" Watch "Jasper Reports Cookbook - One More Question" New topic

Jasper Reports Cookbook - One More Question

Varun Chopra
Ranch Hand

Joined: Jul 10, 2008
Posts: 211

I have one more question.
In one of the projects for which we are thinking of using Jasper Reports, problem is number of report fields can vary.
This is metadata driven and will be decided at runtime.
So question is same jasper report can dynamically increase/decrease number of columns in output report and if yes then is there some example of this in book?


-Varun -
(My Blog) - Online Certifications - Webner Solutions
bilal sidiqui

Joined: Aug 09, 2010
Posts: 17
Hello Varun,

Thank you for your second question.

Dynamic runtime changes in the output report is a common requirement. JasperReports provides a “Print When Expression” property, which is very useful to fulfill dynamic requirements. I have covered the use of “Print When Expression” property in several recipes of the book.

For example, you can check the “Applying styles to your data based on a
logical or mathematical condition” recipe of a sample chapter named “Using Mathematical and Logical Expressions” available for free download from Packt’s Web site.

In this recipe I have used the “Print When Expression” property to show one of a pair of columns and hide the other. The show/hide decision depends on a mathematical condition. You can use this strategy in an almost infinite number of ways.

Please try the recipes of the free sample chapter and post your comments whether or not you like the way I have demonstrated how report designers can play with the “Print When Expression” property for dynamic report design.

Bilal Siddiqui, Author of JasperReports 3.6.0 Development Cookbook
Varun Chopra
Ranch Hand

Joined: Jul 10, 2008
Posts: 211
Thanks again Bilal, I will check and post my comments.
I agree. Here's the link:
subject: Jasper Reports Cookbook - One More Question
It's not a secret anymore!