Home
Analytics
Is there a way to see the .xml code after modifying .rptdesign at the runtime?
newbie321
<p>Hi, </p>
<p> </p>
<p>Is there a way to see the .xml code after modifying .rptdesign at the runtime?</p>
<p> </p>
<p>For example, I would design the report through GUI. This design would correspond to the xml code that I can see from XML tab. Now suppose, at a runtime, I modify the structure, ie add/remove elements. Is it possible to save the modified .rptdesign to a file so that I can later examine the .xml code and compare it to the original .xml?</p>
<p> </p>
<p>Thanks,</p>
<p> </p>
Find more posts tagged with
Magellan BI & Reporting
Comments
JFreeman
<p>I do not believe changes you are making through scripting at runtime can be written back to the XML structure of the report design. I believe they are all going to remain in memory until written to the desired render format.</p>
<p> </p>
<p>To get a report design output with updated XML, you will need to use the Design Engine API (DEAPI).</p>
<p> </p>
<p>Things such as dynamically adding groupings to a table like we have been discussing in the other thread are all done via the design engine API. If you use it in Java outside of the report design, you can then save the modifications back to the report and examine the XML.</p>
newbie321
<p>Hi, #JFreeman:</p>
<p> </p>
<p>Thanks for the pointer!! I did not know how to start and with your help I was able to get closer to the answer.</p>
<p> </p>
<p>It looks like if one is tapping into the designHandle right before engine.destroy() method, then </p>
<p>ReportDesignHandle.saveAs("fileName") does NOT save updated xml....</p>
<p> </p>
<p>HOWEVER, </p>
<p>if you are using ReportDesignHandle.saveAs("fileName") in the the AfterRender() event handler, then the saved .rptdesign report DOES include the modifications that were made at a runtime. I am including a screenshot of the comparison 'before and after' rptdesign modification. </p>
<p> </p>
<p>The question that I am still trying to answer now is:</p>
<p> if ReportDesignHandle is returned by reference (ie the pointer pretty much) and the .saveAs() is invoked right before engine.destroy(), then why are the changes not reflected. I would assume that engine.destroy() gets called way after .afterRender() event. </p>
<p> </p>
<p>Thanks! </p>
<p> </p>
<p> </p>
JFreeman
<p>When you say you are hooking the design handle just before the engine.destory(), are you referring to do that outside of the report design in a java application?</p>
newbie321
<p>I spent couple more hours today tinkering with getting modified xml saved out onto the hard disk. </p>
<p> </p>
<p>Below are my current discoveries both new and old:</p>
<p> </p>
<p><strong>When using the RCP design</strong>, it is possible to save the modified .xml to a separate file using </p>
<p>reportContext.getDesignHandle().saveAs("fileName.rptdesign"). I issued this command in the afterRender event</p>
<p> </p>
<p><strong>When processing the .rptdesign file from Java</strong>, it is also possible to save modified .xml file using the following:</p>
<p>1) create a SessionHandle via IDesignEngine.newSessionHandle(null);</p>
<p>2) obtain a ReportDesignHandle via SessionHandle.openDesign()</p>
<p>3) perform whatever alterations you want</p>
<p>4) save modified .xml to file via ReportDesignHandle.saveAs("fileName.rptdesign")</p>
<p> </p>
<p>once saved, you will see that the xml reflects the modifications one introduced during runtime. </p>
<p> </p>
<p>Thanks again for your help and giving me a starting point where to start. Without that I would still be figuring things out. </p>
JFreeman
<p>You're welcome and thank you for detailing the results of your findings with a well formatted post.</p>
<p> </p>
<p>This is good information to have available for other users.</p>