2004 IR Help Posted September 2, 2006 Share Posted September 2, 2006 By: cosjav - cosjav use iReport with dynamic SQL query? 2004-08-05 00:25 Ok, I have been able to use iReports to generate reports based on a 'static' SQL query (eg. SELECT * FROM Table1 WHERE age=30) but how can I generate a report based on a dynamic SQL query? For example with the query I wrote above, instead of age=30, age can be equal to some variable which is defined through another webpage. (There will be a separate webpage allowing a user to enter in an age in a text box, and when they click submit, this number is sent to iReport??) By: Giulio Toffoli - gt78 RE: use iReport with dynamic SQL query? 2004-08-05 06:19 Use parameters and set your query to something like this: select * from persons where age= $P{MyAge} The MyAge parameter must be declared in values dialog. Take attention to the class type of your parameters. Read jasperreports docs on howto set parameter value at runtime. Giulio By: cosjav - cosjav RE: use iReport with dynamic SQL query? 2004-08-05 20:54 Hi Giulio, Thanks for replying. I did try using parameters but how are the values of these parameters set at runtime? (I cant find the information from the JasperReports docs) I want to have a separate webpage (JSP page) allowing a user to enter in an age in a text box, and when they click submit, this number is set as the value of the parameter... Please help me on how to do this, I am really stuck!! Thanks, Javad By: navy - navydhc RE: use iReport with dynamic SQL query? 2004-08-07 00:34 I meet the same problem,but there is a little difference that the parameters couldnot be fixed on for example : first time SELECT * FROM Table1 WHERE age=?; first time SELECT * FROM Table1 WHERE height=? so I want to know how to realize "where ..." is dynamic? By: flying - ibmj2ee RE: use iReport with dynamic SQL query? 2004-08-18 22:59 use JRDataSource By: Fabricio - fbrmelo RE: use iReport with dynamic SQL query? 2004-08-20 15:06 How ?? By: flying - ibmj2ee RE: use iReport with dynamic SQL query? 2004-08-21 04:10 look for jasperreport's examples CustomDataSource 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