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

how to pass a parameter to subreport


gilbert_1
Go to solution Solved by Thomas Zimmer,

Recommended Posts

Hello all, am having problems deploying jasper reports in a web application. the problem is that the reports work fine when they are on my computer but as soon as their on a web app they stop working. My report has a subreport and that is were the problem lies. The "SUBREPORT_DIR" in the main report .jrxml is hard coded to my computer and will not work if I try it on another compuer or in a web app. I have found that other people have the same problem but I have not come across a solution that works for me. I would grately appreciate some assistance.  I would like to be able to pass the "SUBREPORT_DIR" value from a java program but don't know how to do so. Thank you for your help

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Solution

Have a look at the jasperreports source package. There are a bunch of examples, especially an example with two different ways to execute subreports:

http://jasperreports.sourceforge.net/sample.reference/subreport/

For general, you either have to pass a ready compiled subreport (object) e.g. in a parameter to your masterreport, or you will have to pass a valid subreport expression. This could for example be $P{SUBREPORT_DIR} + "mysubreport.jasper", where $P{SUBREPORT_DIR} has to be a valid path, accessible from your webapplication.

Cheers, Thomas

http://www.thomaszimmer.net

 

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