Jump to content
JasperReports Library 7.0 is now available ×

Relative path for subreport


toxy

Recommended Posts

Hi @all,

searching this forum, I found no hint to solve my problem:

I have a report (iReport 3.7.4, Win7-64) in this directory: C:\Users\Public\DocMgr\JRXML\Personen\Listen_Personen\

Subreports should be placed in: C:\Users\Public\DocMgr\JRXML\subreports

As I don't know the directory structure of the target pc, I've to address the subreport relatively. This should be solved via the parameter "SUBREPORT_DIR". This works fine if I fill it with the absolute path (C:\\Users\\Public\\DocMgr\\JRXML\\subreports\\) - but not with the relative one (..\\..\\subreports\\). I suppose, that my syntax for relative adressing is wrong... the error message is: java.lang.Exception: ..\..\subreports\mysubreport.jrmxl not found

Can anybody help?

toxy

Link to comment
Share on other sites

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

hm, the "Subreport Expression" is  $P{SUBREPORT_DIR}+"briefkopf_hoch.jasper". In the subdirectoy there are both files. Somwhere there is the setting "compile supreports" or similar... so iReports tries to compile it --> jrxml  (if I understand it correctly).

thanks

toxy

Link to comment
Share on other sites

Hi,

The jrxml file is just the file used for development. The JaspersReport engine uses the compiled file (.jasper) for processing the report. iReport automatically compile the jrxml file before executing the jasper file itself.

 

I guess the $P{SUBREPORT_DIR} parameter defaults to the same directory as the master report like this "". If you haven't done yet maybe you need to set this parameter to "../../subreports" first.

 

Personally I just use the relative path directly as the suberport expression, reffering to the relative location of the .jasper file.

Link to comment
Share on other sites

anode36
Wrote:

Personally I just use the relative path directly as the suberport expression, reffering to the relative location of the .jasper file.

This is interesting... how do you write this exactly? In my case I would write: ""..//..//subreports//briefkopf_hoch.jasper" wich is interpreted by the compiler as "../../subreports/briefkopf_hoch.jasper". This expression is correct in all my knowledge of 20 years in IT... but doesn't work! :-(

greetings

toxy

( backslashes printed as slashes!)



Post Edited by toxy at 09/15/2010 06:46
Link to comment
Share on other sites

  • 5 months later...

The problem was solved by our db-developer... the calling application overwrites the parameter "SUBREPORT_DIR" with the right value of the actual installation. So I can develop my reports with a fixed subreports-path according to my installation, customer's installation doesn't bother me...

toxy

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