Jump to content
Changes to the Jaspersoft community edition download ×

Running custom queries directly from the scriptlet


muqker

Recommended Posts

Hi.

 

I have a stacked bar chart that I need to fill with some data that comes from different queries. There is no way I can get all the data I need for the one chart with only one query.

 

What I would like to do is to have a scriptlet function that executes a number of queries, fetches the results, processes the data and then hydrates the chart. I already have a function that feeds the chart some dummy data, I just need to run the queries and fetch the results.

 

Is this possible? If not, can you suggest any other way to solve this?

 

Some code samples would be greatly appreciated, of course :) , but some URL, documentation, even some class names I can search for would also be great.

 

Thanks.

 

-Mihai

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Here is some code to get you started.

 

It gets the connection the report is using:

 

final java.sql.Connection conn = (java.sql.Connection)getParameterValue("REPORT_CONNECTION");

 

Then using the Connection object just create your Statement object and execute a query.

 

Hope that helps,

Mike

Post edited by: mshoe, at: 2007/12/28 19:59

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