Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying subreports in JasperServer

I have created a frame and subreport for integration with APEX and refined to the point I am ready to deploy on JasperServer. Somehow the exact syntax is defeating me. I've tried all the variations the following questions would indicate, but nothing seems to work. I'm using Glassfish, btw, but I don't think that is significant. Here are my questions:

  1. When deploying the subreport, do I deploy as a report or as a JRXML file?

  2. Do I need to set up Input Controls for the subreport, as passed by the frame report?

  3. Does it matter where I deploy the subreport (folder structure) so long as I am passing the correct SUBREPORT_DIR parameter to the frame?

  4. On that SUBREPORT_DIR, I've tried a couple different things. First I had the default as an absolute path on my local box, for debugging purposes, and was passing the value I wanted in the URL (i.e. ...&SUBREPORT_DIR=/Subreports/...). I also tried setting the default to the path I wanted. Neither works, but should the former work as well as the latter?

  5. What's the actual syntax for passing SUBREPORT_DIR? I've deployed my frame report as "/reports/frame" and my subreport as "/reports/Subreports/sub", so I was passing "repo:/Subreports/" (without quotes in the URL, with quotes in the default on frame).

My frame and sub work in iReport with the same params I'm passing, but they don't work from the URL at all. I can load up the sub as a report under JasperServer, pass it the params frame passes, and get it to work, but when I try to run the frame, no dice.

Thanks in advance for all the help, and I hope to pay it back once I get this properly configured.

like image 207
user1073876 Avatar asked Nov 30 '11 17:11

user1073876


1 Answers

OP's findings.

  1. The subreport needs to be deployed in the repository as a JRXML file. It will say "File" in the appropriate column of the repository view.

  2. You do NOT need to set Input Controls for the subreport. The frame report needs only those Input Controls that it utilizes, not the subreport parameters.

  3. As long as you pass the correct SUBREPORT_DIR, you can put the subreport anywhere you want, but remember that the frame report will reference the sub by exactly the name you specify. One of my two problems (see #1 above for the other) was specifying an extension in the default path. This was correct in iReport, but wrong on the server side.

  4. SUBREPORT_DIR can be passed as a parameter and works as advertised.

  5. The correct path for SUB_REPORT_DIR, which I am using now as a defaulted param, is something like "repo:/reports/Subreports/". The Subreport Expression under detail is therefore: $P{SUBREPORT_DIR} + "five_col_sub". See #3 above.

Not that tricky, really, but also not completely intuitive. My colleague pointed out that "repo: " is short for the JasperServer Repository. Seems obvious now, but I was assuming it meant "reports", necessitating that any report with a subreport and the subreport itself would have to exist under the /reports/ directory, which is not the case.

like image 129
2 revs Avatar answered Oct 21 '22 14:10

2 revs