Jump to content

Use multipla datasources within 1 report


fenix4life

Recommended Posts

Hello,

I've searched in the jasper reports and ireport forum but not really found was I was looking for. It could be that was I am aiming for is not possible and should be done in the alternative way.

What we like to achieve is a merge of 2 differente datasources in 1 report.

eg.

-> Database connection (Oracle, SQL Server) with a list of Options

-> A webservice which gives pack a number of prices

Both the database connection and webservice need a parameter to retrieve the information of a vehicle.

Database for vehicle A  

ID   Descr

2     X

9     Y

15   Z

WebService for vehicle A

ID   Price

2     5,5

9     10

15   12,99

 

What I need to display on the detail section would be the merge of both datasources

Descr   Price

X            5,5

Y            10

Z             12,99

Using a subreport to retrieve the price information is not really a useable option. We could use some variables to retrieve the price for every specific option but I do not now beforehand how many options and which ID's they have.

 

A different case is slightly more easier.

Still 2 data sources. One database, one webservice. The result of one field from the database is needed as a parameter of the webservice request.

In some examples the connections are being prepared within the java code but what about passed parameters afterwards.

 

Does any one has an idea how this could be achieved?

If possible some simple examples (jrxml and java)

 

Kind Regards

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

There are several solutions

1. a custom data source which merges both the webservice and the SQL call

2. an helper class to execute the webservice to get the value of a specific item

3. Create some beans, prepare them on the java side and use them to populate the report without care about where the data comes from

4. Use a  subreport to populate a collection returned to the master with the web service call result (the subreport can be 1pixel x 1pixel

5. Use the same trick in 4 but using an helper class and a fake printWhenExpression

others?

Giulio

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...