Home
Analytics
How read XML Joint Data Set
germobirt
<p>Using Birt 4.3.1, I have a XML Data Source.</p>
<p>I've defined some <u>Data Sets</u> and some <u>Joint Data Sets</u>!</p>
<p> </p>
<p>Only the simple Data Sets offer me scripts for e.g. onFetch().</p>
<p>But only in the Joint Data Sets I've the full data, as I can see in Preview Results.</p>
<p> </p>
<p><strong>How can I programmatically read that data (XML Joint Data Set)?</strong></p>
<p> </p>
<p>I think I've to do it that way, because I need that data in the Master Page.</p>
<p>In a Master Page, table elements are not allowed. That's why I've to put the data in a Grid element programmatically.</p>
<p> </p>
<p>Thanks for any help especially with the Joint Data Sets of a XML Data Source!</p>
<p> </p>
<p> </p>
<p>Remark:</p>
<p>With a SQL Data Source / Data Set it worked already. But there I've acces to onFetch()!</p>
Find more posts tagged with
Magellan BI & Reporting
Comments
micajblock
<p>Why are you putting data in the master page? Curious as this is not best practice.</p>
germobirt
<p>The layout of the birt report is strictly bound to an official form that can't be changed</p>
<p>The form can have multiple pages.</p>
<p>And there is a table with data in the footer area among other complex layout elements.</p>
<p> </p>
<p> </p>
micajblock
<p>If you are using separate run and render tasks in your application (which I would recommend anyway) you can put a table in the top of the report wit the data from joined data set, set visibility to false, then put in the onCreate method of the detail row to populate a report or page variable (or even a persistent global variable). The on your master page, in the grids onRender method populate the grid. </p>
germobirt
<p>That is my current try.</p>
<p>I 've the data now in a hidden table and put them in report variables.</p>
<p>The problem is now the order sequence.</p>
<p> </p>
<ol><li>MP : onPrepare() -> last chance to set data in Master Page?</li>
<li>MP : onCreate()</li>
<li>MP : onRender()</li>
<li>BODY : onCreate() -> get the data from the Data Set</li>
<li>MP : onPageStart()</li>
<li>MP : onPageEnd()</li>
</ol><p> </p>
<p>The onPrepare() of the Master Page, where I can set values, is executed long before the onCreate() of the body where my table gets the data!</p>
<p> </p>
<p>Is there a way to change data in the Master Page later?</p>
<p>Or a kind of refresh?</p>
<p> </p>
<p>Trying this in onPageStart() doesn't seem to work?</p>
micajblock
<p>Use onRender events in the master page. This might help explain order of events.
https://www.youtube.com/watch?v=FQ9VjByPNWM</p>
germobirt
<p>The problem is still that all events of the master page, even onRender(), are executed before I've access to the data in the body!</p>
<p>I've an output in every event to verify the order.</p>
<p> </p>
<p>That brings me back to my main question:</p>
<p> </p>
<p>How to read <strong>programmatically </strong>data from a XML Joint Data Set in an event of the master page or in the initialize event.</p>
micajblock
<p>Which brings me back to my first post</p>
<p> </p>
<blockquote class="ipsBlockquote" data-author="mblock" data-cid="138248" data-time="1438786613">
<div>
<p>If you are using separate run and render tasks in your application (which I would recommend anyway)</p>
</div>
</blockquote>
<p>How are you running the report? </p>
germobirt
<p>I'm creating and running my reports in the RCP Designer.</p>
micajblock
<p>Attached is an example using Classic Models. In the first hidden table (which uses a joined data set) in the onCreate method of the Employee Count aggregation I am setting a report variable. In the footer of the master page I have a label where in the onRender method I am setting the text to that same report variable.</p>
germobirt
<p>I'm sorry but the footer label is empty.</p>
<p>(I see only the table data)</p>
<p> </p>
<p>This is the order sequence, checked with debug outputs:</p>
<p> </p>
<ol><li>ON RENDER</li>
<li>ON CREATE</li>
</ol><p> </p>
<p>The render event is to early to find a filled variable.</p>
<p> </p>
<p>If I put a hard coded "Hello world" in the onRender event, I can see that.</p>
micajblock
<p>Are you using the Web Viewer?</p>
germobirt
<p>No. View Report as PDF.</p>
<p>This is the format that will be used.</p>
<p> </p>
<p>What the hack ist that?</p>
<p>In the Web Viewer there are 2 Steps?</p>
<ol><li>INTIIALIZE START</li>
<li>ON RENDER</li>
<li>INTIIALIZE START</li>
<li>ON CREATE</li>
</ol><p>And there is now a red <span style="color:#ff0000;">23 </span>in the label!</p>
<p>But it seems that this is the only output where it works.</p>
<p> </p>
<p>How can I achieve that 2 Step execution with PDF or any other format?</p>
<p>And why are there 2 cases of execution?</p>
micajblock
<p>I will try and answer all your questions.</p>
<p> </p>
<p>Why are the 2 cases of execution? This has always been the case, one (runandrender task) is just simpler to implement in an application. The other uses 2 separate tasks (run task and render task) is the recommended approach. This approach also enables complex requirements such as yours where to gather information in the run task and display that information in the render task. The order of events of the 2 types of execution are obviously different as you found out.</p>
<p> </p>
<p>BIRT Designer uses the the 2 tasks for Web viewer, and the one task for other outputs. You can run the web viewer first then export to PDF which will run the 2 tasks separately.</p>
<p> </p>
<p>So my question to you is how are your deploying your application?</p>
germobirt
<p>BIRT is the report engine of a asset management tool we use.</p>
<p>If I choose there Print (with Birt) I can only choose between PDF, XLS, DOC, HTML.</p>
<p>There is no 'use WebViewer' Option.</p>
<p> </p>
<p>Any ideas left to solve that with the runandrender task or to force run task and render task?</p>
micajblock
<p>Maximo by any chance?</p>
micajblock
<p>The only way I can think of doing this in your environment is to execute the joined data set in the before factory and set the report variables there.</p>
<p>Example on how to execute data sets in the before factory is here:</p>
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/810-dynamic-content-from-library/'>http://developer.actuate.com/community/forum/index.php?/files/file/810-dynamic-content-from-library/</a></p>
;
germobirt
<p>Hi again. First of all, no it's not Maximo, its Valuemation.</p>
<p>With a report using a SQL data source I was able to read all data in the initialize() event!</p>
<p> </p>
<p>But the report with the XML data source, has as data set a<strong> JointDataSetHandle </strong>not the <strong>OdaDataSetHandle</strong>.</p>
<p>I can't find any examples how to work with that.</p>
<p> </p>
<p>The use of setExtensionID() or addPublicProperty() with the <strong>OdaDataSourceHandle</strong>, which needed for SQL, is totally unclear with a XML data source.</p>
<p> </p>
<p>If I ignore them i run into a NullPointerException at the execution of the query:</p>
<p>var qr = pq.execute( null );</p>
<p> </p>
<p>I think I'm very close now, but I need an example how to use <strong>OdaDataSourceHandle </strong>with XML and how to use <strong>JointDataSetHandle</strong>.</p>
germobirt
<p>I'm getting closer, but ...<br><br>
Using the xml data source, I had build some simple data sets and with these some joined data sets.<br>
Using the simple data sets, I can now access their data!<br>
But not with the joined data sets.<br><br>
If I build my own <u>OdaDataSetDesign </u>object using a <u>joined data set</u>, I get this error:<br><em><span style="font-family:arial, helvetica, sans-serif;">Cannot find function getQueryText in object org.eclipse.birt.report.model.api.JointDataSetHandle</span></em><br><br>
Ok, but if I don't use this statement:<br><span style="font-family:'courier new', courier, monospace;">odaDataSet.setQueryText( dset.getQueryText() );</span><br><br>
I get the error:<br><em>The query text is invalid</em><br><br>
So maybe one of the final questions is how to build correctly a <strong>OdaDataSetDesign</strong>, when using a <strong>JointDataSetHandle</strong>?<br><br>
Or maybe I have to use <strong>JointDataSetDesign</strong>, instead of <strong>OdaDataSetDesign</strong>, when using a <strong>JointDataSetHandle</strong>?<br>
But what is right and how is that working?<br><br>
Both ways didn't work with the information / examples I've found so far.</p>
johnw
<p>What you are trying to do is really outside of the scope of the way BIRT was designed to work. But there are a couple of items to try.</p>
<p> </p>
<p>You could try using a hidden data driven parameter which will retrieve all the values from your data set before hand:</p>
<p><a data-ipb='nomediaparse' href='
http://birtworld.blogspot.com/2008/04/data-driven-reports.html'>http://birtworld.blogspot.com/2008/04/data-driven-reports.html</a></p>
;
<p> </p>
<p>or you could try to execute a BIRT report with the values already populated, and store the values in a RPTDOCUMENT, then use the open source RPTDOCUMENT data source to retrieve those values. </p>
<p> </p>
<p>-John</p>
germobirt
<p>I'm not frustrated enough to accept that, because it's working perfectly with 'normal' XML data sets!</p>
<p> </p>
<p>There's an API <strong>org.eclipse.birt.data.engine.api.querydefn.JointDataSetDesign</strong>. Why, if it's not usable?</p>
<p> </p>
<p>I just need a little piece of code that shows the usage of that API together with <b>org.eclipse.birt.data.engine.api.DataEngine</b>.</p>
<p> </p>
<p>I only want to <strong>excecute </strong>a <strong>joined data set </strong>in a script. How is that possible?</p>