Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Connecting child and parent tags in an XML DataSource
radhikamody
<p>Hi,</p>
<p>I am using an XML datasource in my report. I have created multiple datasets for each complex tag that can repeat. But the structure of my XML has parent tags (0..n) and child tags (0..n).</p>
<p> </p>
<p>I need to print the parent tag and its OWN child elements in one table.</p>
<p> </p>
<p>eg.</p>
<p><Person></p>
<p><Name> Robin </Name></p>
<p><Addresses></p>
<p><Address></p>
<p><Street> 123 </Street></p>
<p></Address></p>
<p><Address></p>
<p><Street> 456 </Street></p>
<p></Address></p>
<p></Addresses></p>
<p></Person></p>
<p><Person></p>
<p><Name> Percy</Name></p>
<p><Addresses></p>
<p><Address></p>
<p><Street> ABC </Street></p>
<p></Address></p>
<p><Address></p>
<p><Street> DEF </Street></p>
<p></Address></p>
<p></Addresses></p>
<p></Person></p>
<p> </p>
<p>I want to have the output as </p>
<p> </p>
<p>Robin</p>
<p>123</p>
<p>456</p>
<p> </p>
<p>Percy</p>
<p>ABC</p>
<p>DEF</p>
<p> </p>
<p>How do I achieve this? I am sure it is possible, but the join dataset does not work. If I include all the tags in just one dataset I get just the first occurrence of the children tags.</p>
<p> </p>
<p>I am attaching my XML and BIRT design.</p>
<p>For every <EserciziECH> I want the corresponding <FasciaCommECHPD2> and so on and so forth. </p>
<p> </p>
<p>Is it possible?</p>
<p> </p>
<div> </div>
<p> </p>
Find more posts tagged with
Comments
JFreeman
<p>From my experience, using a Scripted Data Set/Source is going to be one of the better ways to handle complex XML.</p>
<p> </p>
<p>Take a look at the attached example using the sample "Person" data from your post.</p>
<p> </p>
<p>If you are going to be frequently deal with complex XML, it may also make sense to create a custom ODA to handle your XML versus using a Scripted Data Set/Source in each report.</p>
radhikamody
<div>I am not able to preview the report you created. The data source greys out the edit option.</div>
<div> </div>
<div>Alos, how do I attach a file to an existing thread like this one?</div>
radhikamody
<p>where can I find the user guide to create a scripted data source and a scripted data set?</p>
JFreeman
<p>Based on the report you attached it looks like you are using BIRT 2.2.2. The example I created was in 4.4.0 which explains why you could not run it. I'm working on recreating the example in 2.2.2, i'll attach it once i'm done.</p>
<p> </p>
<p>Regarding attaching a file, select the More Reply Options when replying to the thread and there will be an option to attach a file.</p>
<p> </p>
<p>As for resources on creating a scripted data source/set take a look at these 3 to start:</p>
<ol><li><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/506-sample-birt-scripted-data-source-example/'>http://developer.actuate.com/community/forum/index.php?/files/file/506-sample-birt-scripted-data-source-example/</a></li>
;
<li><a data-ipb='nomediaparse' href='
http://blogs.actuate.com/use-json-as-a-scripted-data-set/'>http://blogs.actuate.com/use-json-as-a-scripted-data-set/</a></li>
;
<li><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/1063-eclipses-birt-scripted-data-set/'>http://developer.actuate.com/community/forum/index.php?/files/file/1063-eclipses-birt-scripted-data-set/</a></li>
;
</ol>
JFreeman
<p>Attached is the example built for 2.2.2 BIRT.</p>
<p> </p>
<p>On a side note, I would recommend looking towards upgrading to a newer version of BIRT as 2.2.2 is approaching being 8 years old.</p>
radhikamody
<p>Thank you. I was able to see the script.</p>
<p>Actually we are not using BIRT as an individual software. It is bundled with an Informatica tool that we are using, so we do not have the rights to upgrade to the higher version.</p>
<p> </p>
<p>I was able to get the child and parent tag relationship working by creating two datasets. A parent dataset with the parent tags, and a child dataset for a child with the child tag and one tag from the parent which will be unique. Add a table in the parent table with the child dataset as the binding. In the visibilty check for the child id and parent id to be not equal. I am attaching my report design for reference.</p>
<p> </p>
<p>I have a new issue, The rows of the same table get split. So if I have a table with 2 columns, if the last row is printed at the end of the page, it will split that row as two rows with column1 data in one row, and then go onto the next page and create a new row with just column 2 data. I am attaching the PDF for a better picture. Please have a look at page 6, last row. Can you tell me what do I need to set/change this behavior.</p>
<p> </p>
<p> </p>
radhikamody
<p>Any help on the random page break for the table row will be of great help. Any ideas?</p>
JFreeman
<p>That's a rather strange one. I've not seen something quite like that before.</p>
<p> </p>
<p>I would try adjusting the cell widths on that row and see if it makes a difference.</p>
<p> </p>
<p>Also, do you see the same behavior when viewing the report in the Web Viewer?</p>
radhikamody
<p>I tried adjusting the widths and heights, I see the same behavior. </p>
<p>In web viewer, the page breaks are not visible. It is one long page.</p>