Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » help with XML datasource(help)
help with XML datasource [message #806226] Fri, 24 February 2012 18:19 Go to next message
santiago m is currently offline santiago mFriend
Messages: 4
Registered: January 2012
Junior Member
Hi! Here is some trouble that I have, trying to use an XML datasource:

I have a report datasource(we now will call him "MasterDS") that connects to a data base, and one of the data I want to get, is a string that is formatted like an XML file (really is an XML file, but for performance issues, I save it in the DB like a string).

So far all good, but the problem appears with that XML string, when I want to put some of the attributes of that xml in a table on the report.

One way to do that that I'm trying is:

Creating an XML-data-source with that string XML that is obtained in execution time from a select query. But here comes the question:

Can I create an XML-datasource based on a string instead of a file?? and if I can...

Can I create an XML-datasource at runtime of the report, after getting the string(XML) from a query on the "MasterDS" datasource?


I ask this because I wanted to use the functionality of xml-datasource provided by birt, other way, I think, can be using a parser of XML in a script, after getting the String XML from a query,but is more complex...

I hope you have understood the problem I have, and any help is good!

Thanks!!
Re: help with XML datasource [message #807614 is a reply to message #806226] Sun, 26 February 2012 19:37 Go to previous messageGo to next message
santiago m is currently offline santiago mFriend
Messages: 4
Registered: January 2012
Junior Member
Hi, it´s me again... I saw in the internet, that there is an option of doing this with an imputStream.

If I get the String that has the XML desired, in the time of creation of the DataSources, I can put it in a ByteArrayImputStream and "pass it" to the XML datasource, using the Application Context, but I don´t know how to do it well... because all the examples I saw, they did it through the use of the API and coding, but I will use the BIRT web viewer to show that reports in the web.

so I think that I can pass it using a Script, in the beforeOpen of the XML datasource can be? If is there, how can I get the applicationContext map to put the inputStream that I created(with the XML), for be used by the XML Datasource.

hoping an answer
Santiago
Re: help with XML datasource [message #808485 is a reply to message #807614] Mon, 27 February 2012 20:50 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Why not just get the xml string from the db and then parse the tag you
need in the data expression. Have a look at the attached example.

Jason

On 2/26/2012 2:37 PM, santiago m wrote:
> Hi, it´s me again... I saw in the internet, that there is an option of
> doing this with an imputStream.
> If I get the String that has the XML desired, in the time of creation of
> the DataSources, I can put it in a ByteArrayImputStream and "pass it" to
> the XML datasource, using the Application Context, but I don´t know how
> to do it well... because all the examples I saw, they did it through the
> use of the API and coding, but I will use the BIRT web viewer to show
> that reports in the web.
>
> so I think that I can pass it using a Script, in the beforeOpen of the
> XML datasource can be? If is there, how can I get the applicationContext
> map to put the inputStream that I created(with the XML), for be used by
> the XML Datasource.
> hoping an answer
> Santiago
Re: help with XML datasource [message #809404 is a reply to message #808485] Tue, 28 February 2012 20:55 Go to previous messageGo to next message
santiago m is currently offline santiago mFriend
Messages: 4
Registered: January 2012
Junior Member
yes! that was one of the ideas I had... but analyzing well, the XML I have is complex, so I thought doing this, using a query on an XML-datasource that is based on the string that has the XML.

I create the XML data source based on a string, but my question now is:

how can I pass an object(a String that is the result of a query) from one report to another?? without using a parameter to a page... I saw that I can use the application Context to put the string there, but in the other report, how can I get it??

thank you very much for the answer you gave me!
Re: help with XML datasource [message #809588 is a reply to message #809404] Wed, 29 February 2012 02:40 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If you are running this through the viewer you could add it to session
and read it from session:

reportContext.getHttpServletRequest().getSession().setAttribute("myattr","myattval");
reportContext.getHttpServletRequest().getSession().getAttribute("myattr");

BTW I attached a report that shows how to set the stream in the
beforeOpen of the data set.

Jason



On 2/28/2012 3:55 PM, santiago m wrote:
> yes! that was one of the ideas I had... but analyzing well, the XML I
> have is complex, so I thought doing this, using a query on an
> XML-datasource that is based on the string that has the XML.
> I create the XML data source based on a string, but my question now is:
>
> how can I pass an object(a String that is the result of a query) from
> one report to another?? without using a parameter to a page... I saw
> that I can use the application Context to put the string there, but in
> the other report, how can I get it??
>
> thank you very much for the answer you gave me!
Previous Topic:Date Formatting Issue
Next Topic:Gantt Chart with BIRT DE
Goto Forum:
  


Current Time: Thu Mar 28 09:49:06 GMT 2024

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

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

Back to the top