Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 08:33 Go to next message
J. N. is currently offline J. N.Friend
Messages: 11
Registered: July 2010
Junior Member
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 323 times)
  • Attachment: test.xml
    (Size: 1.11KB, Downloaded 116 times)
Re: How to use XML datasource to render a report [message #1038397 is a reply to message #1037969] Wed, 10 April 2013 20:34 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

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.

Michael

Developer Evangelist, Silanis
Re: How to use XML datasource to render a report [message #1038751 is a reply to message #1038397] Thu, 11 April 2013 09:15 Go to previous messageGo to next message
J. N. is currently offline J. N.Friend
Messages: 11
Registered: July 2010
Junior Member
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 13:07 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

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.

Michael

Developer Evangelist, Silanis
Re: How to use XML datasource to render a report [message #1038895 is a reply to message #1038874] Thu, 11 April 2013 13:37 Go to previous messageGo to next message
J. N. is currently offline J. N.Friend
Messages: 11
Registered: July 2010
Junior Member
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 14:00 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

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 123 times)
  • Attachment: test.rptdesign
    (Size: 53.11KB, Downloaded 352 times)


Michael

Developer Evangelist, Silanis
Re: How to use XML datasource to render a report [message #1039417 is a reply to message #1038917] Fri, 12 April 2013 06:26 Go to previous messageGo to next message
J. N. is currently offline J. N.Friend
Messages: 11
Registered: July 2010
Junior Member
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 20:30 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

No problem. Glad to help.

Michael

Developer Evangelist, Silanis
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: Tue Apr 23 14:33:52 GMT 2024

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

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

Back to the top