Jump to content
Changes to the Jaspersoft community edition download ×

Subreport path


2005 IR Help

Recommended Posts

By: Manish Hatwalne - manish_hatwalne

Subreport path

2004-03-10 20:44

When I give this in my subreportExpression

 

<subreportExpression class="java.lang.String">

"PictureSubreport.jasper"

</subreportExpression>

 

It gives me error at runtime that the subreport cannot be loaded from this location. But if I give complete path on my disk, it works properly.

 

Obviously, I cannot specify the complete path to my subreport. Is there a way to specify relative path of this subreport, or is it posible to get the path of the current report dynamically so that I can prepend it to ths name? Or any other woraround that will allow me to specify only relative path.

 

I cannot alter classpath as it gets set by ANT build for the entire app.

 

TIA,

- Manish

 

 

 

 

 

 

By: David Lim - aberrant80

RE: Subreport path

2004-03-10 22:28

Well, how about actually loading the .jasper into a JasperReport object first? Then you can have:

 

<subreportExpression class="dori.jasper.engine.JasperReport">

$P{PictureSubreport}

</subreportExpression>

 

And you can pass in the JasperReport as a report parameter. I think this is workable.

 

 

 

 

By: Manish Hatwalne - manish_hatwalne

RE: Subreport path

2004-03-10 22:36

Thanks David,

 

But how do I load the .jasper into a JasperReport object? In other owrods how do I set value for $P{PictureSubreport}?

 

TIA,

- Manish

 

 

 

 

By: David Lim - aberrant80

RE: Subreport path

2004-03-11 00:21

If you could get PictureSubreport.jasper compiled and saved, you could load it using the JRLoader class.

 

JasperReport rep = (JasperReport) JRLoader.loadObject("my.jasper");

 

then you can use 'rep' as the value for the parameter map, like

map.put("PictureSubreport", rep);

 

and just make sure you have this in your subreport

<parameter name="PictureSubreport" class="dori.jasper.engine.JasperReport"/>

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