JasperServer - null values for input controls - jasper-reports

Recently I got some help with grouping when a user enters a null value into an input control ("Rolling up" groups in Jaspersoft iReport). I am using iReport/JasperServer Professional 4.5.1. My three levels of grouping are pharmacy, facility, and packaging type.
After deploying the report to JasperServer, I am having some trouble with nulls. I unchecked "always prompt" for my input controls, and when the report opens the first time it acts as though it has received null values for all input controls and groups appropriately (which is what I want). The display mode for my input controls is "in page", so they're displaying on the left-hand side of the screen. When I then try to select one pharmacy and re-run the report (expecting aggregate values for facilities and packaging types, since I didn't select anything for those controls), the report performs like the aggregate code doesn't exist, and lists all facilities and all packaging types.
However - if I save that one selected pharmacy as a saved input control, then go back out to the repository and run the report using the saved input control, it works fine, and aggregates all facility and packaging type data.
Any thoughts?
Thanks,
Lisa

My input controls are multi-select queries and my parameters are collections. I discovered that when I first entered the report by clicking on the link in the Repository, the report was being sent null values. However, when I was trying to run the report again after opening it in JasperServer, I was generating empty lists.
Matthew Dahlman suggested I create parameters in iReport to handle null values and "roll up" my grouping. Those parameters looked like:
$P{packtype}==null ? " 'All Package Types' " : " FAC.PACKTYPE_CODE "
That works beautifully in iReport and on first opening the report in JasperServer. To handle an empty list AND null values, I had to change my parameters to:
$P{packtype} == null ? " 'All Package Types' " :
($P{packtype}.isEmpty() ? " 'All Package Types' " :
" FAC.PACKTYPE_CODE ")

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.

SSRS does not work when input parameter has a + sign

I'm creating a report which has as input parameters: id and name. These parameters are used in the where clause of the select from which I get the records to display in my list.
The problem is that if there is a + sign into the name the parameter (that I print on the page to display the filter) name appears with a space instead:
Input parameter = "record+story"
Parameter shown in report: "record story"
So the result of the select is empty, since the name doesn't match!
What am I missing?
EDIT: I open the report through a client application, based on VB6. There is a main page with a table and a list od ids, when I click on a row of the list it redirects me to an IE page performing the filtering and showing only the needed data.
The parameters are: id - Integer, and name - text.
When it opens the IE page I see that if the name contains a plus sign there appears instead a space, which of course is wrong, therefore the resulting report is empty.
I already tried to add the System.Web reference to VB6 in the client application, but it doesn't work.
Here a picture to clarify what I mean.
Thank you
C.
In the end I got the solution. I only need to encode my parameter so that the + sign is read as a + sign. This is achieved by using the hex value in the code behind:
example: namewithplussign ==> replace(namewithplussign , "+", "%2b")

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.

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

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

"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.