Deploying subreports in JasperServer - jasper-reports

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:
When deploying the subreport, do I deploy as a report or as a JRXML file?
Do I need to set up Input Controls for the subreport, as passed by the frame report?
Does it matter where I deploy the subreport (folder structure) so long as I am passing the correct SUBREPORT_DIR parameter to the frame?
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?
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.

OP's findings.
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.
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.
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.
SUBREPORT_DIR can be passed as a parameter and works as advertised.
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.

Related

Crystal Reports - suppress subreport parameter prompts

I have a Crystal report with several subreports linked on a common field - all working great. Now must add another, very complex, existing report as a new sub. This report's data source code stretches several pages. It also has over a dozen parameters which are further imbedded in numerous formula fields through out. That said, it runs fine and has a parameter that links with the main report. Unfortunately all the other parameter prompts is supremely annoying.
I've searched high and low for a method to accept default values without prompts but Crystal doesn't seem to accommodate that notion.
Revising the report to remove all the unneeded parameters would be extremely painful and simply not an option.
I'm hoping to find an alternate way to pass the parameter values to prevent the prompt. I'm aware of the SetParameterValue() method of the ReportDocument class but not sure how to use it. I've found examples of how to use it with C#, VS, ASP.net, etc., none of which work for an end user like myself.
Could the data source command itself be used?
Much thanks for any recommendations, guidance or thoughts!
With Command Level prompts, you would never be able to change the prompt values with the CR Viewer.
If the report is supposed to be viewed in the CR Viewer and you need the functionality or changing prompt values, try this:
1) Remove Command Level prompts
2) Create the Data prompt in the report from the Field Explorer
3) Create a Record Selection formula like this:
{date_field} = {?Date_prompt}
under Report > Selection Formulas > Saved data
4) Save the report with data
Try this...

How to embed JasperReport sub-report into a jar

I have a jasper (master) report embed in a jar. The report is got from a java input stream. The jasper report is made by iReport 3.7.0
In this master report, there are a few sub-reports. At the moment I have to use
Subreport Expression : $P{SUBREPORT_DIR} + "\\SubReport.jasper"
Expression Class : java.lang.String
in the iReport to make it works. It means that I store the subReport.jasper in SUBREPORT_DIR folder.
My question is, how to embed these sub-reports in the jar like the master report? And what should fill in the "Default Value Expression"? (if it is needed)
The closest question and answer so far I have seen is in here
How to load subreport resources with Jasper?
However the answer is not sufficient to me for master report compile. There is an error message saying missing sub-report when compile (and this is why I think the Default Value Expression may be needed?)
Thank you very much!
for example:
i have report and subreport, located in some *.jar file. to invoke subreport i set subreport expression
getClass().getResource("/path/to/my/report/in/a/jar/subreport.jasper").openStream()
and choose subreport expression class java.io.InputStream
it is working!
I've described one possible solution in an answer in another question. Question is not identical, but the solution solves this problem also.
That solution uses spring, but replacing spring specific parts (FileSystemResourceLoader) with Class.getResourceAsStream() should not be too big of a problem.

Cascading input control is empty while accessing a Jasper Report

I call a jasper report through an independent URL through which I pass one of the input controls needed to run the report.
E.g. http:// localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&standAlone=true&reportUnit=xyz&ParentFolderUri=abcd&j_username=xyz&j_password=xyz&parameter1=value1& . . .
As you can see in the above independent URL, I pass the JasperServer username and password, reportUnit name and location and other mandatory parameters, along with the report input parameter, i.e., "parameter1" which can have a value like "value1".
I used a mandatory, read-only and visible input control for this input value. Its value would come from the independent URL, showed in the box but was read-only and hence could not be changed.
The report was working absolutely fine upto this point.
But the tragedy began when my client rejected this idea. He wanted a completely invisible input control to my report and the input value would be passed through the independent URL, just like illustrated above.
And then my client asked me to refer to this and made me work on cascading input controls.
Recently I added a cascading input control to this report. The input control type is a single select query, which utilizes two parameters that I pass to the report through the independent URL.
Now when the Jasper server responds to the independent URL with the input parameters, all the other static parameters work properly, except for the cascaded one.
When I click the select box of the cascaded input, I can see the desired options for a second, and then, it just goes empty while I'm viewing the select list.
But when I make the "Parameter1" input control visible, the cascading input control works!
And then I turn in invisible, the cascading input control turns into a beast that does things by itself and not listen to his master.
I am not able to understand why this is happening. Could anybody please provide me a solution to this?
I have found a temporary solution for this.
I made the "Parameter1" input control visible and read only.
Next, I used a stylesheet and defined a style rule that would affect that input control's display on the web page, making "display: none".
I passed the name of the stylesheet through the URL. So this stylesheet is used for the report.
Now, the "Parameter1" input control is invisible to the end user and my report still runs with no one knowing it's just a fix.

Linking subreports in iReport so they also work in Jasper server

Using iReport v4.0.1 with Jasperserver v4.1.0 I'm trying to find a syntax for linking subreports to the main report that lets me test it in iReport then deploy to the server through the repository browser.
The default syntax for sub-reports in iReport for the subreport expression is something like
$P{SUBREPORT_DIR} + "mySubReport.jasper"
When you deploy this from iReport it's smart enough to pick this up and suggest changing it to
"repo:mySubReport.jrxml"
and to then deploy all subreports to the Resources folder of the main report.
That's great, but unfortunately it then edits the file in iReport to save this change which means you can no longer run the report in iReport without manually re-editing all the sub-report expressions - this makes the process of testing and deploying to the server really painful, particularly when there are multiple sub-reports in a report.
I thought I could at least set the value of $P{SUBREPORT} to be "repo:" or "My\local\filepath" so that at least I'd only have one place to change it, but the compiler doesn't like that.
Is there an alternative structure or an expression that will resolve to repo:*.jrxml or My\local\filepath*.jasper correctly depending on where you're running the report from?
The best solution to this is to add an additional parameter like $P{IsOnServer}. Set the default value to true. For your subreport expression use this:
$P{IsOnServer} ? "repo:mySubReport.jrxml" : "/local/path/to/mySubReport.jasper"
When you run the report in iReport, you'll be prompted for the value of IsOnServer. Make it false; the subreport expression will resolve to your local file. On the server, don't define an input control. The users will never be prompted for that parameter (they won't even know it exists), and it will result to the desired 'repo' syntax.
An even better solution would of course be for iReport to handle this automatically... but for now you need to do something like this.

How to change the SSRS input parameters position in report

My SSRS report contains 7 input parameters and while running my report the size of the parameter(i.e. length) is increasing.
One of my input parameter(drop down list) may contain 100 characters so the size is not constant but i want to place all parameters in 2 lines or 3 lines(in a row).
Now it is coming 2 parameters per a row
Please advice
As gbn indicates, it's not easy to change the built in report server method of presenting the parameters. SSRS likes to always use two parameters per line, presented in the order that they exist in the report (which must match the dependency order.)
So the alternatives that gbn mentions: Both involve building a "Wrapper" application: some custom code or a web page that you can code however you like to get the parameters. Then you call Reporting Services, either in code or by passing a formatted URL with your parameters. The report can be displayed in a frame, new window, or passed as a stream to where ever you'd like.
The URL access is pretty straightforward and reliable: I often use it either by hand (to create "favorites") or in code.
http://msdn.microsoft.com/en-us/library/ms153586.aspx
For what you are looking for, these might be more work than you expected, but they will be extremely flexible for your interface.
Jamie
You can certainly do that, just right click on the RDL file in the solution explorer and select view code. then move the XML tags named <ReportParameter Name="Nameofparameter"> under <ReportParameters> according to where ever you want to position. And then save it. thats it!!!
The report parameters are kind of floating in values of 2, so if u have 4 report parameters then it will be shown as 1,2 next line 3,4. Best of luck!!
Use ASP.NET for the paramaters and a ReportViewer control or URL access to render. Seriously.
I don't know of any option to present parameters any way other then the default
I believe you could try using jQuery. The report parameters are rendered in a table under a div tag with class sqlrv-ParameterContainer. Write a jQuery or JavaScript function that will extract the full innerHTML from this div ie. the table content and then extract the table row information like the <label> or <input> tags.
Create your desired table structure with <table><tr><td>{extracted sections}</td><td></td></tr></table> or leave it to your requirement...
Then just append this new HTML structure in place of the original default structure.
In jQuery it will be like
$(".sqlrv-ParameterContainer").html();
which will give you the entire table structure that comes inside the parameter. Use XML parsing and get the input controls and all. Extract these controls as-is, don't change anything.
$(".sqlrv-ParameterContainer table").remove(); // it will remove the SSRS rendered default table from DOM
$(".sqlrv-ParameterContainer table").appendChild('<table><tr>......</tr></table>'); // Append your custom html structure here....
This was something that came to my mind quickly... I would suggest you test it... :)
This doesn't help the OP with SSRS-2008 but in case it helps others - Microsoft have improved this in SSRS 2016 - parameters can now be easily managed via the GUI in Report Builder / Visual studio:
https://www.intertech.com/ssrs-parameters-2016-update/