Skip to main content



      Home
Home » Archived » BIRT » How to use XML datasource to render a report(How to display a structured XML file)
icon5.gif  How to use XML datasource to render a report [message #1037969] Wed, 10 April 2013 04:33 Go to next message
Eclipse UserFriend
Hi guys,

let's say I have a XML file attached.

I'd like to display in the report a list of persons displaying name and titles. That's something what I was able to do, but then I want to display a contacts that are in 1 to N relationship to that person and I found it as a problem. Can you please help?

In general I do not know how to relate email to the current person.
Report is attached.

Thanks a lot for the hint ...



<indicativeOffer>
<persons>
<person>
<role>GUARANTOR</role>
<detail>
<firstName>Janko</firstName>
<lastName>Hrasko</lastName>
<birthDate></birthDate>
<titleBefore>Ing.</titleBefore>
<titleAfter>Art.</titleAfter>
</detail>
<contacts>
<emails>
<email>janko.hrasko@gmail.com</email>
<email>janko.hrasko1@gmail.com</email>
</emails>
<phoneNumbers>
<phoneNumber>0910 444 567</phoneNumber>
<phoneNumber>0910 444 777</phoneNumber>
</phoneNumbers>
</contacts>
</person>
<person>
<role>MAIN_APPLICANT</role>
<detail>
<firstName>Janko1</firstName>
<lastName>Hrasko1</lastName>
<birthDate></birthDate>
<titleBefore>Ing1.</titleBefore>
<titleAfter>Art1.</titleAfter>
</detail>
<contacts>
<emails>
<email>janko1.hrasko@gmail.com</email>
<email>janko2.hrasko@gmail.com</email>
</emails>
<phoneNumbers>
<phoneNumber>0910 444 567 111</phoneNumber>
<phoneNumber>0910 444 777 111</phoneNumber>
</phoneNumbers>
</contacts>
</person>
</persons>
</indicativeOffer>
  • Attachment: test.rptdesign
    (Size: 19.60KB, Downloaded 346 times)
  • Attachment: test.xml
    (Size: 1.11KB, Downloaded 137 times)
Re: How to use XML datasource to render a report [message #1038397 is a reply to message #1037969] Wed, 10 April 2013 16:34 Go to previous messageGo to next message
Eclipse UserFriend
To get the emails all within your dataSet, you would need to make the <email> node your row mapping. This would allow you to grab each email and the appropriate contact info. However, only the first phone number will be grabbed. So, you'd likely need at least two dataSets because of how the XML is laid out.
Re: How to use XML datasource to render a report [message #1038751 is a reply to message #1038397] Thu, 11 April 2013 05:15 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for response,

however can you please suggest how to do it? I want to have a following layout


---------------------
Person 1 details
---------------------
emails
---------------------
phones
---------------------
Person 2 details
---------------------
emails
---------------------
phones
---------------------

or can you please suggest best practice how to design XML to be able to do such things in BIRT ?

Thanks
Re: How to use XML datasource to render a report [message #1038874 is a reply to message #1037969] Thu, 11 April 2013 09:07 Go to previous messageGo to next message
Eclipse UserFriend
Here's a way to do it with your XML as attached. A second dataSet is used to grab the person's first and last names and their associated phone numbers. This table is then embedded in the group footer and filtered to show all phone numbers for the given contact.
Re: How to use XML datasource to render a report [message #1038895 is a reply to message #1038874] Thu, 11 April 2013 09:37 Go to previous messageGo to next message
Eclipse UserFriend
Super ! works like a charm ... Thanks a lot

now back to my question ... What is the best practice for creating XML's that fit the BIRT design?

Or is it ok to design all XML/reports as this one ?

Thanks
Re: How to use XML datasource to render a report [message #1038917 is a reply to message #1037969] Thu, 11 April 2013 10:00 Go to previous messageGo to next message
Eclipse UserFriend
I don't know if I'm the best person to say the ideal XML setup Smile, but if you were to do something like the attached XML file, you could use a single dataSet, which can be found in the updated report design. With lots of data, the single dataSet should be faster because you don't have to use a filter.
  • Attachment: test1.xml
    (Size: 1.05KB, Downloaded 158 times)
  • Attachment: test.rptdesign
    (Size: 53.11KB, Downloaded 370 times)
Re: How to use XML datasource to render a report [message #1039417 is a reply to message #1038917] Fri, 12 April 2013 02:26 Go to previous messageGo to next message
Eclipse UserFriend
thanks for the hint Wink
Re: How to use XML datasource to render a report [message #1039927 is a reply to message #1039417] Fri, 12 April 2013 16:30 Go to previous message
Eclipse UserFriend
No problem. Glad to help.
Previous Topic:NullPointerException on BIRT 2.6.2 after viewing report for a few times
Next Topic:Deploying to BIRT 4.2 Viewer Web App
Goto Forum:
  


Current Time: Thu Apr 24 10:50:22 EDT 2025

Powered by FUDForum. Page generated in 0.04229 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top