Jump to content
JasperReports Library 7.0 is now available ×

Subreport file location


2004 IR Help

Recommended Posts

By: Lukas - loester

Subreport file location

2005-04-18 04:49

Hello

 

I've got reports that have several subreports (and even these have subreports).

I compile, fill and format the reports within a webserver.

 

The problem is I do not know how subreport .jasper files are found when filling a report with data.

 

How can tell jasper in which directory to search for the .jasper subreports (which I dynamically compile as required)?

 

Feel free to ask if you need further details on how I've implemented it so far.

 

 

 

 

By: o_kevin_o - o_kevin_o

RE: Subreport file location

2005-04-22 13:12

You can pass the subreport as a parameter to your report.

 

 

 

 

By: ekimrepeel - ekimrepeel

RE: Subreport file location

2005-04-22 13:49

Try putting the fully resolved path name of the subreport(s) into the main report.

 

 

 

 

By: William Baker - wlbaker

RE: Subreport file location

2005-04-22 16:28

I was told that you could use a string for the subreport name in the Expression with a value class of java.lang.String. The report loader is supposed to search the classpath to determine if the string is a class name. That never worked for me, though I did not dig into it too deeply.

 

The method I have been using is to use

new File( $P{BaseDir}, "SONotes.jasper" ) as the Expression and java.io.File as the value class. This works well. You will notice that $P{BaseDir} is an Parameter, which can be a static string with a default value and the "Prompt" parameter set to "No". I can also pass this parameter down to the subreport so that it too can load subreports. If you use JasperAssistant, you should know that you can enter values into the "Value Class" field that are not in the drop-down list.

 

This solution has worked for me in a number of environments. You may find better solutions.

 

 

 

 

 

 

By: Keenan Brock - kbrock

RE: Subreport file location

2005-04-26 11:02

If you want to pass the subreport as a parameter into the report, put the subreport file name in the parameter's description field.

 

This will allow you to easily find the subreport's file name.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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