2006 IR Open Discussion Posted August 18, 2006 Share Posted August 18, 2006 By: Adam Silverthorne - doog2112 Dynamic report designs 2003-04-17 10:58 I'm wondering if it is possible to dynamically create a report design at runtime. As an example, I want my users to be able to choose the fields in the report, but because of my design, not all reportable fields are columns in the database. Some are custom fields that they have defined and they exist in another table. I need to be able to gather all the fields they need and pump them into the content section at runtime. Is this possible with Jasper reports? By: Teodor Danciu - teodord RE: Dynamic report designs 2003-04-17 11:47 Hi, Check the "noxmldesign" sample provided. There the report template is create at runtime programatically. You can store the initial template in an XML file, load it, allow users to modify it, but then you have to compile it before filling it. To not compile reports every time, I think it is better to allow users to create report templates by modifying proposed base templates and then storing them in a compiled form (.jasper) for later use. I think storing compiled report templates is a better idea then forcing users to redefine templates every time they want to fill them. Each user can create its own set of templates that he/she will use later multiple times. Some modifications do not require report template recompilation. It is about the modifications made on a JasperReport object and not a JasperDesign object. This can be seen in the "alterdesign" sample. For complex report design modifications that require recompilation you'll use the JRXmlLoader class to load JasperDesign objetcs and the JRCompileManager to compile them in order to obtain JasperReport objects that you can fill with data. I hope this helps. Teodor By: Sanjib Islam - islam_s RE: Dynamic report designs 2003-04-21 08:06 Hi Teodor, We are working on using Jasper report's dynamic report generation in our application (swing, web start based). We liked the overall approach of Jasper report's report generation but the run time compilation of report is something that we think will get our application into problems down the road. I was wondering if there's some way of avoiding this compilation. What I have noticed is this compilation creates a bytecode which is later loaded as calculator object (in fillManager -> JRFiller -> JRBaseFiller) of JRBaseFiller. If I define an interface for the calculator object and instantiate that based on the report design and then all I have to do is make that calculator object available to JRBaseFiller. Is this possible or, there's better way that you'd like to suggest? I'll highly appreciate your help in this regard. Thanks, Sanjib 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