multiple subreports - deploy on Jasperserver

0

Hi all,

I've created a subreport that calls another subreport (creating a sort of three-level hierarchy). In iReport everything works fine.

Now I want to deploy these 3 reports on Jasperserver, but I'm facing a problem: if I deploy the master report, Jasperserver recognizes and uploads only the first subreport. What is the right way to do a deploy in this case?

Thanks,

Simona

 

simonabertozzi's picture
Joined: Oct 13 2011 - 6:47am
Last seen: 1 year 8 months ago

2 Answers:

2

 

Hi Simona,
 
deploy the subreports manually. two posibilities:
 
1) In the Repository Navigator, click on the subfolder "Resources" of your report and add your subreports as JRXML Documents
 
2) In the Web-UI of JAsperreports Server Edit the report, Select Controls & Resources from the left menue, then add your subreports as JRXML Documents (Resource)
 
BEWARE! In both cases you have to change the subreport expressions (in all reports using a subreport) Jasperreports Server uses expressions like "repo: reportname.jrxml" (in iReport you have a static path to your local file system). For the main report and the regular upload, iReport will change these expression, for your subreport and its sub-subreports you wil have to do this for yourself.
 
A good practice would be to store the subreport paths in a parameter ($P{SUBREPORT_DIR}), then pass the variable around to all subreports. so you will have it to change only in the main report. But additionally you will need another variable to set the file extension "jrxml"; in iReport you need the extension "jasper"...  My proposal: use parameter $P{SUBREPORT_DIR} with default value "repo:" and $P{SUBREPORT_EXT} with default value ".jrxml". Activate the "Use as prompt" option for the parameters. Your subreport expression(s) will be
 
$P{SUBREPORT_DIR} + "reportname" + $P{SUBREPORT_EXT}
 
If you execute your reports in iReport, you will be requested to give the file path and extension, on the server everything will be fine.
 
Other way would be to upload reports only once (with the manual corrections wrote above), then always execute the report remotely (right click in the repository navigator, "Run Report"; if you edit your report or subreport, open them from the repository navigator, then upload and run remotly again)
 
However, each possible solution for this has its own pitfalls (e.g. iReport will not compile the subreports automatically anymore, you will have to upload the subreports as resources manually...
 
Cheers, Thomas
Thomas Zimmer's picture
Joined: Oct 2 2012 - 1:35am
Last seen: 1 week 3 days ago

jasper server 5.6 doesnt have a resources folder in teh root/repository view

john.v.little - 5 years 2 months ago

I'm in the same situation, but with JasperStudio 6.1.1 and JasperServer 5.

So far, I have done what you advice:

<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "ClaroVideoR1_Det.jasper" + $P{SUBREPORT_EXT}]]></subreportExpression>

But I get many errors when I try to run the report on JasperServer.

chicolinux - 3 years 6 months ago
0

It works! Thank you very much.

simonabertozzi's picture
Joined: Oct 13 2011 - 6:47am
Last seen: 1 year 8 months ago
Feedback