Jump to content

Executing a procedure with some report results


Brokenbone

Recommended Posts

Hi all!

 

I'm new to JasperReports and I've been using it for a month now without any major problems. Now I ran into one I can't solve.

 

For the purpose of some kind of custom SELECT auditing I have to call a procedure (INSERT some records) from the result set into the database. I'm using JDeveloper and have a method for shoving reports that loads compiled report from some location, fill the report with some parameters and export report to PDF.

 

Is there a way somewhere in between to get the result sets from the report, because I would need the values of one column from every record shown in my report, and than call some stored procedure with this values?

 

Thank you in advance!

BB

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Brokenbone wrote:

Is there a way somewhere in between to get the result sets from the report, because I would need the values of one column from every record shown in my report, and than call some stored procedure with this values?

 

Try using a scriptlet, which would give you access to the report field values.

 

Regards,

Lucian

Link to comment
Share on other sites

Hi Lucian!

 

Thanks for your suggestion but I'm pretty new to Java too. :blush:

I've red the documentation on scriptlets and tried to run the scriptlet example from the samples page. I can't get even this working. When I compile the report without changing it it anyhow I get the ClassNotFoundException. Even if I set the Scriptlet property of the document to Use iReport internal scriptlet support, I still have the same error. Found the thread with the same problem on forum but without a solution.

 

Maybe you can point me to some more information on this subject, where could I read some more about Scriptlet property for example, Scriptlet class, maybe some other example or tutorial.

 

Thanks!

BB

Link to comment
Share on other sites

Hi Lucian!

 

I've somehow created a scriptlet class which I've compiled in my JDeveloper ViewController project. The problem I now have is the access to the DB to call a stored procedure. Jdev has application module for this, but I can't get a reference to it from my scriptlet class. (Probably the class that is referenced from jasper report has another session or something like this?)

 

Is there a way to get the DB connection in scriptlet class and call DB procedure directly, without the reference to the Model project. I hope I make myself clear enough to get some suggestions.

 

Thanks!

Link to comment
Share on other sites

I'm not sure I understand your question (maybe because I don't know anything about JDeveloper).

 

Which DB connection do you want to get hold of in the scriptlet? If it's the report connection, all you have to do is

Code:

Connection connection = (Connection) getParameterValue(JRParameter.REPORT_CONNECTION);

 

Regards,

Lucian

Link to comment
Share on other sites

Hi!

 

Thank you for your help. I've made this work a little different. For someone using JDeveloper it might give some idea if he/she runs at a similar problem. I didn't use any connections, I just wrote the information I need to ProcessScope parameters, which I then used in the class where my report gets filled. This way I can use any ADF/BC elements including application module.

 

Take care!

BB

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