Jasper Reports

JasperReports: Same File for Server and Desktop

http://stackoverflow.com/questions/7413216/linking-subreports-in-ireport-so-they-also-work-in-jasper-server

 

The best solution to this is to add an additional parameter like $P{IsOnServer}. Set the default value to true. For your subreport expression use this:

$P{IsOnServer} ? "repo:mySubReport.jrxml" : "/local/path/to/mySubReport.jasper"

When you run the report in iReport, you’ll be prompted for the value of IsOnServer. Make it false; the subreport expression will resolve to your local file. On the server, don’t define an input control. The users will never be prompted for that parameter (they won’t even know it exists), and it will result to the desired ‘repo’ syntax.

An even better solution would of course be for iReport to handle this automatically… but for now you need to do something like this.

Leave a Reply

Your email address will not be published. Required fields are marked *