Jump to content
We've recently updated our Privacy Statement, available here ×

Scriptlets in Adhoc reports


gushie

Recommended Posts

I have my own jar file containing a Scriptlet class (extends JRDefaultScriptlet) which I share across many reports.

I've produced a report, with parameters, which accesses these scriptlets in the usual manner $P{REPORT_SCRIPTLET}.myFunction() and I set the scriptlet class in the report properties in iReport.

 

My scriptlet jar file is in the WEB-INF/lib folder on jasperserver

 

I've uploaded the report into the Ad Hoc Components/Topics folder. If I run this report on the server via the Repository then it works great, and finds/runs the scriptlet methods without any problem.

 

However when I attempt to run the report via the Ad Hoc Editor, then it loads the fields OK, I choose some and click run. I get an error:

 

The method myFunction() is undefined for the type JRAbstractScriptlet

value = (java.lang.String)(((net.sf.jasperreports.engine.JRAbstractScriptlet)parameter_REPORT_SCRIPTLET.getValue()).myFunction()); //$JR_EXPR_ID=1$

 

How do I get the Ad Hoc editor to refer to my class? I've tried uploading the JAR file as a resource file to the report as well, but it made no difference.

 

Thanks.

Post edited by: gushie, at: 2008/04/24 10:05

Link to comment
Share on other sites

  • 3 months later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Ad Hoc does not preserve the scriptletClass from the topic.  In fact, Ad Hoc topics have a finite set of supported attributes since the ad hoc feature is geared towards fast report development for non technical users.  For reports that requires scriptlets, they would have to be created in iReport and deployed to the server.

Link to comment
Share on other sites

  • 5 years later...

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...