mmcdonald Posted January 18, 2007 Share Posted January 18, 2007 I'm using iReport to display DB results from application testing. It would be convenient to be able to present the query that was used to generate a report within the report itself, say in the Summary band, so that others could validate the SQL. Is there any facility in iReport to accomplish this? Link to comment Share on other sites More sharing options...
jmurray Posted January 18, 2007 Share Posted January 18, 2007 If you don't pass parameters into your query then you could define your entire query inside a parameter. Your query expression would then simply be $P!{yourQueryParameter}. You could then set up a Field Text box in the summary section with it's expression being $P{yourQueryParameter}. But remember you can't pass a parameter into another parameter before the query is filled, so this would only work for static queries. Link to comment Share on other sites More sharing options...
jmurray Posted January 18, 2007 Share Posted January 18, 2007 If you pass parameters into a query then you can simply replicate the query text in a Text Field. For example, if you have an SQL query like this: select * from tbl_site_$P!{SITE_CODE} where site_status=$P{SITE_STATUS} and property_group = $P{PROP_GROUP} then your Text Field expression would be: "select * from tbl_site_" + $P{SITE_CODE} + " where site_status=" + $P{SITE_STATUS} + " and property_group > " + $P{PROP_GROUP} Link to comment Share on other sites More sharing options...
mmcdonald Posted January 18, 2007 Author Share Posted January 18, 2007 Thanks for the reply; that would be a way to do it. It would be great if there was a way to get a parameterized query dynamically. Is this possible in the JasperReports API? 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