booyeeka Posted October 8, 2006 Share Posted October 8, 2006 Hi all! Can you help me how to send complete SQL query into JasperReports, from Java code. If in Java code I send (put) one parameter, like: Code:String empid = "3";reportParam.put("EMPID", empid); ... this example works, by a simple call of next query in Jasper's XML file: Code:[code]select * from employees where Employee_ID = $P{EMPID} BUT, when I try to call query in java file like : Code:[code]String empid = "select * from employees where Employee_ID = 3";reportParam.put("EMPID", empid); ... with $P{EMPID} only defined in jasper file, I get the following error: Code:[code]java.lang.NullPointerException Can you tell me where is my mistake? Thank you in advance! Link to comment Share on other sites More sharing options...
booyeeka Posted October 8, 2006 Author Share Posted October 8, 2006 It looks like I did manage to solve my problem. In Jasper Report Query, I defined parameter as : $P!{EMPID} ... and it works good. I post this, because I noticed that a lot of JasperReports user have same problem. But BTW, JasperReports really rocks! Link to comment Share on other sites More sharing options...
pedror Posted September 1, 2010 Share Posted September 1, 2010 Hi! I'm facing similar issues, about sending a complete query from my java application to my .jrxml file.In this last file I define the parameter like that:<parameter name="queryReport" class="java.lang.String"/><queryString> <![CDATA[$P!{queryReport}]]> </queryString> When I print the report what I get it's the query ( SELECT .... FROM ...) and not the result like it was suposed.What I'm doing wrong? Any Ideias....Thanks Link to comment Share on other sites More sharing options...
julio_cortorreal Posted September 4, 2023 Share Posted September 4, 2023 When you send a sql script via a parameter jasper reports can't identify the output data even though the query runs successfully, you can't slice the data into variables to load the data into the report.you must create the names of the output fields to obtain them 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