JasperReport parameters works in iReport but fails on JasperServer with input control - jasper-reports

JasperServer doesn't pass parameter from input control to the report for some unknown reason.
I defined a jrxml report with iReport 4.6 (even tried compatibility mode 4.0.1) using input parameter which works in iReport.
When I deploy the report on jasperserver 4.5 the response I get is "The report is empty".
Same report without parameter works also well.
Naturally I defined and attached input control with single-select query.
The value column and the visible column in input control is the same DB field I use as parameter in jrxml.
Query values as possible input are displayed fine, but when I choose one..."The report is empty"!!.
I tried simplifying the report but my parameter from input control just wont be passed through to render the report.

You must create the parameter in jasperserver too (not only in iReport), with same name.
In JasperServer, edit your report, define "Input controls" with same ids and go thru wizard, it should work now.
If you like to test first select "Always require in emergin window".
You can also look at the answer here http://jasperforge.org/node/543148

Related

How to link an Input Control to a report's Parameter

I'm unable to link an Input Control to my report's Parameter. I feel I'm doing right, but I can't see the desired result in the final report.
My intention is to create a list, filled by some options, and display the list in a report as a parameter, so the user can (multi)select the options. As far as I know, I must create an Input Control on the server, create a Parameter on the report using the same name between the Input Control and the Parameter.
I've created a List of Values named ListaCalificaciones as follows:
Then, this is the Input Control:
Finally, this is the parameter:
However, when it comes to show the report on Jasper Server's web interface, I can't see a filled input:
Am I missing something?
By the way, I'm using Jasper Studio 6.6.0 and Jasper Server 7.1.0 (compiled version 20180504_1307).
Edit 2018/10/05 13:04
I've changed the input control, so that the id is ic_calificaciones and the name stays as it was (Calificaciones). I've found a way to make it work. First, I deploy the report to my server (local server in my case). Then, I edit the report, go to "Controls and resources", remove the ic_calificaciones parameter and add a InputControl parameter to the report. That way the Calificaciones parameter gets filled up with options.
I found the solution, it was just in front, but due to a poor UI I just didn't realise...
You must edit your parameter's name to match the Input Control's name, in my case it ought to be ic_valoracion. Then, the parameter-to-input-control-binding has to be made when publishing the report to the server.
So, being in Jasper Studio, click on publish button, as seen in the following picture:
Now, select the location where to publish the report. Then, the second step is what we're looking for, it's the place where you must select the resources to publish. As seen in the next image, you must edit your parameter's type to select "Link To Resource", click on whichever place and a new prompt will appear. Now, there, select the desired Input Control.
Finally, test your report.

How to display the report without applying the input values in the jasperserver for the first time

I have published a report from iReport to jasperServer with cascading parameteres.
I have set default values to cascading parameters.
While running the report in jasperserver it is asking "You must apply input values before the report can be displayed."
Is it possible to display the report first time with the passed default parameter values without applying anything.
Then if i need i will change any value and click the apply button, the value will come respectively.
Please suggest. Thanks in Advance.
Go to JasperReport server (like http://localhost/jasperserver/)
Edit the report (Manage Server -> Repository -> select you report -> click Edit button)
Open Controls & Resources tab
Uncheck Always prompt option, and give default values in iReport parameters.

Single value input control not visible on JR Server

I have two parameters in report:
week ---> has isForPrompting="true" property
year ---> has isForPrompting="true" property
But when I add a single value input control and run the same report on JasperReports Server, only a pop up window is opening up and not the the single value input control.
Also If I add a single value input control to my other reports, its showing up when I run the reports on JR Server.
I really don't understand why the single value input control is not showing up for the current report when everything is running well on iReport designer?
Most common problem: Your input control doesn't match exactly. The input control ID has to match the parameter. Remember that it's case sensitive.

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.

"Document has no pages" on iReport and nothing on OpenReports

I am having an issue with JasperReports I can not solve. I am using Eclipse, OpenReports 3.2 and IReport 3.7
The issue I am having is that the report does nothing. When I preview the report in IReport I can at least get a "Document has no pages" message but when I try to open it using OpenReports it doesn't do anything. I get the open reports header and the copyright message but nothing between them.
I was able to track it down to line 150 in ReportRunAction.java in OpenReports. That line is:
jasperPrint = jasperEngine.fillReport(reportInput);
At least that is the line the page dies on. It trips the catch block that the line is inside of but the error is empty. When I try to print the description it is null. I can't swear that the issue isn't that parameter. Through looking around all I have been able to find is something about how the report needs to be compiled with the same version of the jasperreports.jar that OpenReports uses. I have no idea how to tell if/what version of jasper reports is being bundled into the .jasper file though.
Is that my problem? If so how do I tell/set the version of the jar that gets bundled? If not; help!
The no pages messages comes out when the report has not records or you discarded all of them with a wrong filter expression.
There are a couple of things you can try:
set the filter expression to:
new Boolean (true)
This will in some way reset your filter expression.
Right click your jasper report
properties
find more...
and Set the report property "When no data" to "All sections no details" so you can see at least the rest of the report.
Thanks.
If you are using the Detail Bandeport, then you will need a Data Query for the report. Since it's returning "No Pages" in iReport, then you either don't have a query. Or simply your query is not returning any rows.
In old iReport, from Data menu, choose Report Query and write your query here. If you want only one record (i.e. Detail band only one time) you can use a dummy table. Like:
SELECT 'a' FROM DUMMY
Otherwise, if you don't want to use the Detail Band, you have the option to view the other bands without using a query. From Edit menu, choose Report Properties, under More... tab, set the flag When no data to All Sections, no detail
Your problem is not exceptions or errors, it's just no data to show.
Any Empty Datasource will do the trick too.
I ran into the same error when using IReports when I had a subreport that only contained other subreports and no actual query. Adding a dummy query as medopal suggests fixes the no pages error and allows things to run correctly.
See also: http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=49315
I've been facing this error for a while. In my case, this error occurred because of an image. If you have images in your report file, you will be forced to fill image with valid data when you wanna use report. If you don't, you will see this error "Document has no page". To address this problem just set "on error type" field in properties window (just click on image you'll see the property window) to "blank".
Strong wish.
I had same problem and got after searching problem, that I did not provide password to connection.
so I add these lines to my java code.
Class.forName("com.mysql.jdbc.Driver");
con =DriverManager.getConnection("jdbc:mysql://localhost:3306/stock_mngt","root","your password");
now my code works.