2002 JI Open Discussion Posted August 18, 2006 Share Posted August 18, 2006 By: Jan Kroulik - honzak123 how to pass a report parameter to DataSource? 2003-06-19 03:27 Hi, I want to have in my subreport a parameter like "Select * from TABLE where ID=$P{ID}" and use it in MyDataSource object. I can't use directly a database connection, because I need to preprocess the result. The problem is that I don't know how to read the parameter from my report and pass it to the MyDataSource. I have tried to use scriptlet and read report parameters in method beforeReportInit(), but it's too late. Jasper report reads data form the DataSource even before it invokes this method. Do you have any idea? thanks By: Giulio Toffoli - gt78 RE: how to pass a report parameter to DataSource? 2003-06-19 05:42 You must have YourDataSource instance before call the fill method of JR. This means that you should adapt your query outside JR when JR engine is not started yet. If you cannot do this, the only solution is "filter" at report generation time your records using bands printWhen expressions or similars. Giulio By: Jan Kroulik - honzak123 RE: how to pass a report parameter to DataSource? 2003-06-19 07:24 printWhen expressions or anything else at report generation time can't help me. I need to add extra atributes (columns) to the result. I can of course adapt MyDataSource instance before calling the fill method and when creating MyDataSource instance in DataSource expression. But I will have many reports and SQL queries and I wish to store each query in it's jasper report XML, not separatly. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now