Jump to content

Scriptlet in groovy?


harry.clarkknovalent.com

Recommended Posts

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

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...