Jump to content

Subreports!!!!!


2005 IR Help

Recommended Posts

By: Manish Hatwalne - manish_hatwalne

Subreports!!!!!

2004-03-10 23:41

I give up!!!!!

 

I tried n no of ways to get my subreport displayed without giving the absolute path on disk but none works. Can someone help me finding what am I doing wrong????

 

I have a subreport "PictureSubreport" so I tried following things but none is working. Note that all my classes nad hence subreport gets inside a package.

 

my package is com.mypackage.jasper

 

So I tried -

 

(1) Using basic subreportExpression -

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

"PictureSubreport"

</subreportExpression>

 

(2) Next I tried -

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

"com.mypackage.jasper.PictureSubreport"

</subreportExpression>

 

And my classpath includes jars containing these reports.

 

(3) I tried setting a variable in scriptlet using -

public Boolean setSubreport() throws JRScriptletException, JRException{

JasperReport subreport = (JasperReport)JRLoader.loadObject("PictureSubreport.jasper");

this.setVariableValue("Subreport", subreport);

System.out.println(subreport);

 

return Boolean.FALSE;

}

 

and I used this variable as follows -

 

<subreportExpression class="java.io.InputStream">

$V{Subreport}

</subreportExpression>

 

But they all result in JRexception saying unable to load "PictureSubreport", what do I need to change and where should I look to get my subreport path/location correct dynamically. I can't specify it as a static complete path (it works with that though).

 

I am really confused!!! Any help will be highly apprciated.

 

TIA,

- Manish

 

 

 

 

 

By: Manish Hatwalne - manish_hatwalne

RE: Subreports!!!!!

2004-03-10 23:45

BTW,

 

I have tried option (1) and (2) with .jasper added at the end, forgot to post in comments here.

 

- Manish

 

 

 

 

By: Chuck Deal - cdeal

RE: Subreports!!!!!

2004-03-11 08:07

The way I handled this problem was to always send a parameter called ReportPath to my reports. The value represented to location of my reports. Then I would prepend this parameter to the subreport name. Works like a charm.

 

 

 

 

By: Manish Hatwalne - manish_hatwalne

RE: Subreports!!!!!

2004-03-11 09:40

The problem here is the name of the main report is passed to the custom framework (huge existing code) through a configuration file, and I can only change name of report in this file, cannot pass a parameter to th emaster report. So helpless on this count...

 

Is there a way to know location of the current report sing some predefined variable or path??

 

TIA,

- Manish

 

 

 

 

By: Carlos Costa e Silva - carloscs

RE: Subreports!!!!!

2004-03-11 10:11

It seems the expression is the path to the report - not classname or whatever.

 

So. the expression should probably be:

 

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

"com/mypackage/jasper/PictureSubreport.jasper"

</subreportExpression>

 

 

 

 

 

By: David Lim - aberrant80

RE: Subreports!!!!!

2004-03-11 17:43

tried this?

 

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

"com.mypackage.jasper.PictureSubreport"

</subreportExpression>

 

 

 

 

By: David Lim - aberrant80

RE: Subreports!!!!!

2004-03-11 17:44

oops... i meant replacing the expression part with a parameter of type 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...