harry.clarkknovalent.com Posted September 11, 2007 Share Posted September 11, 2007 Can I write a scriptlet in Groovy? I need to call some complicated Java in the iReport event model that scriptlets uses, at afterDetailEval and other spots. I want to make the Java available to non-programmers without having them write a Java scriptlet and make a jar. Can I put the Java call in a Groovy scriptlet? I need 3 lines, to get a field from a query, format it, and assign it to a report variable: date = (java.math.BigDecimal)getFieldValue("T1_CAEJDT")s1 = DateFormat.toString(date)setVariableValue("invoiceDate", s1) When I put this in the scriptlet editor it tries to compile it even if I set language=groovy Is there a way to use the first 2 lines in an expression, without the last line, which now is the expression value on the report? Again, i'm trying to provide Java code without burdening non-programmers. Thanks. Link to comment Share on other sites More sharing options...
harry.clarkknovalent.com Posted September 11, 2007 Author Share Posted September 11, 2007 I can call the Java from an expression, passing the field to be converted as an argument: ((net.sf.jasperreports.engine.VanguardDateFormat).vanguardToString($F{T1_CAEJDT})) The Java goes into a jar, which the user has to install, but otherwise needn't bother with it. Good boy, Jasper. Have a bone. Link to comment Share on other sites More sharing options...
harry.clarkknovalent.com Posted September 11, 2007 Author Share Posted September 11, 2007 It works in iReport but not in JasperServer. I've added a class to a package net.sf.jasperreports.engine.VanguardDateFormat and put the jar in the webapps/jasper/lib dir with the groovy jar. The class is found in iReport but not in JasperServer: 1 - Error evaluating expression : Source text : ((net.sf.jasperreports.engine.VanguardDateFormat).vanguardToString($F{T1_CAEJDT}) 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