Jump to content

How to use multiple type of datasource?


nitin403

Recommended Posts

Hi!

I need to create a report which take XML as well as SQL data.

My Report Need SQL data and Lotus Notes data.

Since jasper doesn't support Lotus Notes data so we may convert Notes data into XML data manually.

 

1). Any Suggestion in how to convert Lotus Notes data into any usable datasource in jasperReport.

 

2). This is the main Q? That is it possible to use multiple datasource. If yes then how to do that.

 

My thank's to you in advance. :)

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

(A question to the moderators: are normal users, like me, allowed to trie to help other users? if not: sorry for my reply, you can remove it if you want)

 

at your first question: I dont know :)

at your second question: It is certainly possible to use multiple datasources. I think you want to try to use a masterreport and a subreport. That way your masterreport can use a SQL dataset, and your subreport can use a xml datasource

(you can find an example of master/subreports on this site)

Link to comment
Share on other sites

Thanks A lot giroe.

 

A Question.

 

My both the datasource are not fixed.

 

And in the JasperfillManager just take one connection object as far as I have seen.

 

So how can I use 2 datasource for my report.

 

Thank a lot for your help once again.

Link to comment
Share on other sites

giroe wrote:

A question to the moderators: are normal users, like me, allowed to trie to help other users?

 

Of course, the idea of this forum is to allow the JasperReports community to share knowledge/ideas/solutions/etc. Contributions from the community members is hence desired, welcomed and appreciated.

 

Regards,

Lucian

Link to comment
Share on other sites

You really should download some example reports from this site. I found one that is called: xmldatasource

I think if you take a look at that one your problem will be solved. You should give the sql connection to your fillmanager (this is your masterreport).

Than in your masterreport (let's say: masterreport.jrxml) you create a subreport (let's say: xmlreport.jrxml and xmlreport.jasper). In the properties of the subreport on your masterreport you go to Subreport tab. There you must shoose: Dont use connection or data source.

In the Subreport(other) tab subreport expression should be: "xmlreport.jasper". In your xmlreport.jrxml you should set your Report query language to: XPath and than you set the query to what you want te retrieve from your xml file.

Little example from this site:

report query: /Northwind/Customers

<Northwind>

 

<Customers>

<CustomerID>ALFKI</CustomerID>

<CompanyName>Alfreds Futterkiste</CompanyName>

<ContactName>Maria Anders</ContactName>

<ContactTitle>Sales Representative</ContactTitle>

<Address>Obere Str. 57</Address>

<City>Berlin</City>

<PostalCode>12209</PostalCode>

<Country>Germany</Country>

<Phone>030-0074321</Phone>

<Fax>030-0076545</Fax>

</Customers>

So with the query: /Northwind/Customers you can retrieve al the childnodes: customerId,companyName,etc

 

EDIT: Just saw in the example that you have to give a few parameters to the subreports. Those parameters can be set in your java code. So in the java code those parameters are given to your masterreport. Than in this masterreport those parameters are given to your subreport. I dont think you really understand me? thats why you really should have a look at that example yourself

Post edited by: giroe, at: 2007/07/25 07:47

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...