2002 JI Open Discussion Posted August 18, 2006 Share Posted August 18, 2006 By: suyash - suyash JasperDesign:How to manipulate it at run time 2003-05-08 23:04 HI !! i m using jaser reports 0.4.5 & iReport for creating Jasper Designs. But my requirements is to add or remove some of Test fields from design at run time at users choice. User selects fields of table from GUI & clicks on generate report button. I need to show only those fields in the report. Is it possible to do it in any way? By: mike w - mwans RE: JasperDesign:How to manipulate it at run time 2003-05-09 14:06 You may want to try dynamic query strings and use groups creatively to display only the data needed. However, it is my understanding that you cannot change the attributes (page size, column number) of a report at runtime. By: Teodor Danciu - teodord RE: JasperDesign:How to manipulate it at run time 2003-05-10 12:20 Hi, Some of the report settings can be changed at runtime, even on a compiled report design (JasperReport object), without need for recompiling it. You have to check the API to see what are those settings that can be changed. Adding and removing elements in a report design is an effect that can be achieved using the <printWhenExpression> functionality, but with one condition: The compiled report design has to contain all possible elements. Only at runtime, depending on the parameters we pass to the report filling process, some of the elements will appear and others will not. But they all have to be there in the report design, with their corresponding <printWhenExpression>. Recent version of JasperReports let you rearrange elements in bands by modifying the "x" and "width" properties. But not the "y" and "height" properties which could have implication in the consistency of the overall report design. Such changes are permitted because they do not require report design recompilation. They might suit some scenarios, but not all. This is why in more complex situation, it is impossible to alter the report design without the need to recompile it. And since the report compilation process is time consuming, I always point out this solution: Even if your users have the possibility to choose themselves the information they want to have on their reports, it does not mean they have to describe their templates every time. It is recommended that you offer your users the possibility to define their templates once and then use them over and over again. This way you compiled them only when the users create or modify them and not with every call. Each user could create its own set of report templates using a simple tool and could easily reuse them instead of defining them every time he/she wants to print. I hope this helps. Teodor Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now