Here's something that tripped me up when developing my first JasperReport containing a sub-report for use with the JasperReport grails plugin.
In order for the sub-report to resolve correctly you need to add a parameter to your parent report called SUBREPORT_DIR. This is then set by the JR plugin, and makes everything work as expected.
When specifying the sub-report location, set it to
$P{SUBREPORT_DIR} + "mysubreport.jasper"(assuming your subreport is in the same directory as the parent report and called mysubreport.jasper) Don't forget to give the parameter a default value of empty string so that it still works when previewing in iReport. You also need to remember that the plugin runs the compiled versions (*.jasper not *.jrxml) so you need to compile the reports with iReport before running the application.
Comments
It some how works when i preview it in Ireport thou.
Check that your iReport version matches the plugin.
cheers
Lee
I'm trying to send a java.util.Date parameter from my controller.
In the controller method the parameter is a java.util.Date, but in the JasperController it's suddenly a String. The report throws a net.sf.jasperreports.engine.JRException: Incompatible java.lang.String value assigned to parameter xxxx exception.
Any ideas?
make sure the compiled .jasper files are being put into the war correctly.
What is the error you're getting?
I worked on this a while ago and can't really remember the exact workings of SUBREPORT_DIR. Perhaps it needs to be set to an absolute path so it works when running inside your application server.
cheers
Lee
I haven't used the Jasper plugin on any 1.1 applications unfortunately so it is possible that this approach no longer works.
I think I discovered this way with some good old fashioned debugging so that may be worth a shot using 1.2 so see what the plugin is doing.
cheers
Lee
for my next attempts.