aihtnyc Posted July 15, 2014 Share Posted July 15, 2014 Hi!I´m changing a report to JasperReports. It was made in other IDE with a Procedure that executes every row that DataSet read.I´m trying to change that Procedure to Java language to have a better usability and maintainability, but i´ve been looking all the post and testing all the answers and it didin´t work for me.¿How can I embed my java functions into my report?Thanks.PD: I´ve just test this : http://community.jaspersoft.com/questions/527056/can-we-use-java-functions-ireport Link to comment Share on other sites More sharing options...
rajesh.sirsikar Posted July 15, 2014 Share Posted July 15, 2014 Hi aihtnyc,You can create scriplets and call them in your report execution to use any user defined class. For more info check this blog.http://ankurthetechie.blogspot.in/2014/01/all-you-want-to-know-about-scriptlets.htmlThanks,Rajesh S Link to comment Share on other sites More sharing options...
aihtnyc Posted July 15, 2014 Author Share Posted July 15, 2014 Thanks, but Scriptlets doesn´t work too.Is it possible to fix it?I´ve got this next error:CLASS FILE EDITORSource not Found The JAR of this class file belongs to container 'JasperReports Library' which does not allow modifications to source attachments on its entries.// Compiled from JRDefaultScriptlet.java (version 1.6 : 50.0, super bit)public class net.sf.jasperreports.engine.JRDefaultScriptlet extends net.sf.jasperreports.engine.JRAbstractScriptlet { // Method descriptor #6 ()V // Stack: 1, Locals: 1 public JRDefaultScriptlet(); 0 aload_0 [this] 1 invokespecial net.sf.jasperreports.engine.JRAbstractScriptlet() [8] 4 return Line numbers: [pc: 0, line: 41] [pc: 4, line: 43] Local variable table: [pc: 0, pc: 5] local: this index: 0 type: net.sf.jasperreports.engine.JRDefaultScriptlet // Method descriptor #6 ()V // Stack: 0, Locals: 1 public void beforeReportInit() throws net.sf.jasperreports.engine.JRScriptletException; 0 return Line numbers: [pc: 0, line: 51] Local variable table: [pc: 0, pc: 1] local: this index: 0 type: net.sf.jasperreports.engine.JRDefaultScriptlet // Method descriptor #6 ()V // Stack: 0, Locals: 1 public void afterReportInit() throws net.sf.jasperreports.engine.JRScriptletException; 0 return Line numbers: [pc: 0, line: 59] Local variable table: [pc: 0, pc: 1] local: this index: 0 type: net.sf.jasperreports.engine.JRDefaultScriptlet // Method descriptor #6 ()V // Stack: 0, Locals: 1 public void beforePageInit() throws net.sf.jasperreports.engine.JRScriptletException; 0 return Line numbers: [pc: 0, line: 67] Local variable table: [pc: 0, pc: 1] local: this index: 0 type: net.sf.jasperreports.engine.JRDefaultScriptlet // Method descriptor #6 ()V // Stack: 0, Locals: 1 public void afterPageInit() throws net.sf.jasperreports.engine.JRScriptletException; 0 return Line numbers: [pc: 0, line: 75] Local variable table: [pc: 0, pc: 1] local: this index: 0 type: net.sf.jasperreports.engine.JRDefaultScriptlet // Method descriptor #6 ()V // Stack: 0, Locals: 1 public void beforeColumnInit() throws net.sf.jasperreports.engine.JRScriptletException; 0 return Line numbers: [pc: 0, line: 83] Local variable table: [pc: 0, pc: 1] local: this index: 0 type: net.sf.jasperreports.engine.JRDefaultScriptlet // Method descriptor #6 ()V // Stack: 0, Locals: 1 public void afterColumnInit() throws net.sf.jasperreports.engine.JRScriptletException; 0 return Line numbers: [pc: 0, line: 91] Local variable table: [pc: 0, pc: 1] local: this index: 0 type: net.sf.jasperreports.engine.JRDefaultScriptlet // Method descriptor #24 (Ljava/lang/String;)V // Stack: 0, Locals: 2 public void beforeGroupInit(java.lang.String groupName) throws net.sf.jasperreports.engine.JRScriptletException; 0 return Line numbers: [pc: 0, line: 99] Local variable table: [pc: 0, pc: 1] local: this index: 0 type: net.sf.jasperreports.engine.JRDefaultScriptlet [pc: 0, pc: 1] local: groupName index: 1 type: java.lang.String // Method descriptor #24 (Ljava/lang/String;)V // Stack: 0, Locals: 2 public void afterGroupInit(java.lang.String groupName) throws net.sf.jasperreports.engine.JRScriptletException; 0 return Line numbers: [pc: 0, line: 107] Local variable table: [pc: 0, pc: 1] local: this index: 0 type: net.sf.jasperreports.engine.JRDefaultScriptlet [pc: 0, pc: 1] local: groupName index: 1 type: java.lang.String // Method descriptor #6 ()V // Stack: 0, Locals: 1 public void beforeDetailEval() throws net.sf.jasperreports.engine.JRScriptletException; 0 return Line numbers: [pc: 0, line: 115] Local variable table: [pc: 0, pc: 1] local: this index: 0 type: net.sf.jasperreports.engine.JRDefaultScriptlet // Method descriptor #6 ()V // Stack: 0, Locals: 1 public void afterDetailEval() throws net.sf.jasperreports.engine.JRScriptletException; 0 return Line numbers: [pc: 0, line: 123] Local variable table: [pc: 0, pc: 1] local: this index: 0 type: net.sf.jasperreports.engine.JRDefaultScriptlet} Link to comment Share on other sites More sharing options...
hozawa Posted July 15, 2014 Share Posted July 15, 2014 Attach your source code. It seems like you7re doing something fundamentally different. Link to comment Share on other sites More sharing options...
aihtnyc Posted July 15, 2014 Author Share Posted July 15, 2014 full source code? Link to comment Share on other sites More sharing options...
hozawa Posted July 16, 2014 Share Posted July 16, 2014 No. Just a simple few lines sample code to show us what you're trying to do. A sample scriplet can be found in the pages below. Try them before writing your own. http://www.tutorialspoint.com/jasper_reports/jasper_report_scriptlets.htm http://jasperreports.sourceforge.net/sample.reference/scriptlet/ FYI:There's actually several ways to add codes: (1) Add to the JasperReports library (2) Add to the JasperReports Studio (using scriplets). 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