2005 IR Help Posted August 26, 2006 Share Posted August 26, 2006 By: John Wells - jbwiv Displaying dynamically built query at runtime 2004-03-16 10:45 I have a number of reports that build large dynamic queries based on parameters passed in. I'd like to either print this query in the report or dump it to file at runtime for debugging purposes. Is there a way to access the query from within the report definition (xml)? Thanks, jbwiv By: C. Richard Jamieson - rykk RE: Displaying dynamically built query at runtime 2004-03-16 11:06 Are you attempting to read the xml in java? By: John Wells - jbwiv RE: Displaying dynamically built query at run 2004-03-16 11:08 rykk, Well, i'm designing my reports with iReport and then viewing the compiled versions with the Jasper viewer. I was hoping there was a built-in variable that would allow you to print the report query so I can see exactly how the thing has been built based on my paramters...something like $V{REPORT_QUERY} or the like.... By: Richard Barnett - richard_barnett RE: Displaying dynamically built query at run 2004-08-15 23:53 Not sure if this helps, but you can do this easily if you generate the report from Java: add the query itself as a parameter; use a custom datasource which dumps the ResultSet data to a file or logger as the framework iterates through the records. By: C. Richard Jamieson - rykk RE: Displaying dynamically built query at runtime 2004-03-16 11:50 I searched and could not find an answer the only reference I found to the query was "sqlQuery" when the query is being passed to the report. Sorry - hope someone else can help By: John Wells - jbwiv RE: Displaying dynamically built query at run 2004-03-16 12:36 No problem...thanks for trying! By: cosjav - cosjav RE: Displaying dynamically built query at run 2004-08-05 17:01 Hi jbwiv, Having read your post here I'm sure you will know the answer to this. I'm trying to do this and am stuck at step 2: 1. there will be a JSP page that will allow the viewer to select from a range of data (eg. choose to list all products bought from Feb 2004 till May 2004) 2. Once they have made their selection and clicked submit I need to have certain variables in this selection passed to the relevant JasperReports parameter to dynamically form the SQL query. 3. Next I need to read from a MySQL database to retrieve the relevant data and display this data on the next page for the user to view (using JasperReports) Can you guide me as to how I can go about doing step 2? Is there a very similar sample that I can look at? I would really appreciate ANY suggestions. Thanks, cosjav By: Laurent Asfaux - del65 RE: Displaying dynamically built query at runtime 2004-08-06 05:10 You can dynamically modify an SQL query within a report by entering $P{<parameter_name>} in your query syntax. An example : select nbShipsSolds from Bunkers where Bunkers.city = $P{city} Have a good reporting time ;-) 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