JasperReports parameters works in iReport but fails on JasperReports Server (II) - jasper-reports

I have a very similar problem to the one described at [JasperReport parameters works in iReport but fails on JasperServer] post.
The report works properly within the iReport environment using Preview option but fails within JasperReports Server
The comments suggest that iReport does not create the InputControl within JR Server. So I verified that the server contained the proper InputControl (that apparently solved their issue).
The input control called sk serial selection :
ID: ic_sk_serial
Name: sk serial selection
Type: Single Select Query
Mandatory: false
Read Only: false
Visible: true
Query resource:
From repository (pointing to *q_sk_serial* see below)
Value and Visible columns:
Value column: id
Visible query columns: serialnr
The input control query called q_sk_serial (populate the inpute control with a list of alphanumeric serial numbers, items are unique):
select id,serialnr from "public"."serials" order by serialnr;
The parameter name:
ic_sk_serial
The report query:
select * from "public"."datas" datas where datas."serialnr" like $P{ic_sk_serial}
In my case, input control seems to work properly in both environments (within iReport preview and JasperServer): I populate a list of items coming from the same database; I see that dropdownlist as expected within iReport but also on with JR Server.
Within iReport, the drop-down list returns the correct selected value in a report parameter which lead to the correct report. In JasperReports Server I only get a "The report is empty" message. So I tend to think the report parameter is not properly passed through within JasperServer.
Hardcoding the "Input control" output value, shows expected report.
Side note: I am using iReport 4.7.1 in compatibility mode with JasperReports Server 4.5.0.
I would be glad to hear if anybody ran into the same problem?
How can I debug further the report execution in JR Server?
Is compatibility mode susceptible to cause that issue?
What about the input parameter type? I use a query that return a string. However my input data type is text (closest match to string). My parameter type is java.lang.string. Does this make sense?

Actually that is a simple bug:
I just found out that:
value column: id
Should be
value column: serialnr
Still, I do not understand why the report was working in preview mode? Such big mistake should fail on preview no?
In anycase thanks to everybody to lead to my mistake ;)

In my point of view, there are two types of parameter within a jasper report including: Report parameter and Dataset Paramter.
Firstly, you must create both parameters and then map the one of Dataset to the one of Report.
I encountered the same problem to you thus that resolved my case.

Related

Jaspersoft Studio: Force input parameter of subreport to be entered manually

In my main report I get a (small) list of string values from the data base. I then want to use this list for selecting records in a subreport, along with other input parameters:
The user shall be able to select records based on a range of begin and end date -- this is easy using an input parameter of type java.util.Date with "Is For Prompting" set to true. Another criteria shall be one or more items from a list showing values from a data base field. I could define the list in the report template, but then I'd have hard-coded strings (filled from the data base, but at definition time only).
Now the dilemma is: If I define the input parameters in the main report, I cannot get the values for the list beforehand; if I define them in the subreport, I get no prompt at all, so there's no way to set any of them.
So the report requires values for start and end date, and a list of string values to select from (multiple itmes can be selected). This list shall be built from values from the data base. In the subreport all these values shall be joined into a filter for the records. A user shall be able to define the dates and select items from the list manually before executing the report.
Is there a way to achieve this?
After some more hours of trial & error, and some more research, of course, I found that the keyword is "Query-based Input Controls". This documentation describes their creation on the JasperReports Server. Such input controls can be edited in Jaspersoft Studio as well, however, they actually work on the server only. Anyway, this is the solution to my problem.

Loading values in ireport parameters box

In ireport when clicking on preview, and you have parameters, you'll get a parameter box where you put a certain value to get specific record(s).Now i am trying to put specific values in the parameter box, so that the user would choose between it.
The same goal as in this so question : Loading promt box with parameters in iReport
However i want to do it without using Jasper Server. Is it possible to achieve this only from within IReport Designer?
You can do this,right click on the input control and select to add the local input control and provide id and name for the input control
Under the input control details select single select list of values if you have the list of values with you or if you want to add the data of a column as drill down select single select select query and extract that field.
This will help you to drill down the data.
Thanks and Regards
Megha
I'm pretty sure you can not do this in iReport preview. Have no clue what #Megha is refereeing to....
You can provide default value for your parameter through the <defaultValueExpression> tag and decide if you wan't it to prompt or not to prompt with the isForPrompting attribute.
Why can't we have select list, well I guess iReport is a tool for developers, so the preview is only to test the report. For customers jasper soft have developed the jasper report server.
And remember you can always develop your own interface (in swing or on the web)

"The Report is empty" - is bug?

I've created report with 3 parameters in iReport and it's running successfully. The report is execute MS SQL stor proc with 3 parameters:
startdate;
enddate;
dept_nm (department name);
iReport gives good result. As soon as I exported jrxml file to JasperReports Server 4.1 I have message "The report is empty".
In the Repository under JasperReports Server I've created controls for dates parameters and single list values for dept_nm parameter.
Do you know how to debug and trace this message coming from???
Your query is returning no data. The message appears when the report result is null.
The quickest way to debug this in JasperReports Server is to modify the report's behavior when no data is returned. The default behavior is "No Pages". Change it to "All Sections, No Details". That way you'll get at least the report title and summary band.
Display your parameters in the title band to see what their values are. Often they aren't what you expect. For example, your input control is "StartDate", but your parameters is "startdate". So the parameter doesn't get the value you thought it would.
I get this a lot. E.g if you have sub reports only, it thinks the main report is blank. You have to do something silly like insert a dummy SQL into your report such as "select 1" then populate a hidden part of the report with the result. When it works on in report studio, but gives you the report is empty on the server (with a good data source - other reports working) is when you have real trouble. Not solved those yet.
Maybe you did not connect your report to any Data Source.

Reporting services cascading parameter not working

I want the report to pick default date time values based on a location parameter the user picks, but the problem is that the date time parameters don't update when the user picks a different location. I made sure to put the location parameter above the date time parameters but it is still not functioning as I expect, what am I doing wrong here?
Unfortunately this is "by design".
Microsoft Connect - SSRS - default not refreshed for cascading parameters.
Posted by Microsoft in 2007: "As described, this is not
a bug. We do not re-evaluate the default value for a subsequent
parameter unless the selected value is no longer in the valid values
list. We do not know whether the current value was specifically
requested by the user or it is there because of the default. You could
make a case to have control over this behavior through some sort of
property but it is currently working as designed."
I think this is a bug in SSRS. But Microsoft have closed the issue. Please log onto connect and vote this to be fixed if it is affecting you too
Microsoft Connect - Your feedback improving Microsoft products.
Workaround / hack is here: Boyan Penev - SSRS Cascading Parameters Refresh: Solved.
However the hack only works if the dependent parameter has a LIST of valid values, and other users report that it only works for the first dependent parameter.
If the dependent parameter is free-form entry or a date, the hack cannot be used at all.
Consider putting your datetime values in a dataset with logic based on the location parameter
SELECT CASE #Location WHEN 'Paris' THEN GETDATE()+10
WHEN 'Berlin' THEN GETDATE()+11
WHEN 'New York' THEN GETDATE()+8
ELSE GETDATE() END as DefaultDate
Then set the date parameter default value to this dataset.
Unfortunately, SSRS does not refresh cascading parameters once they have been set. Other than reloading the report, the only way that I am aware of is to create a custom UI using the ReportViewerDialog.
I have found that if you use a stored procedure to render the child parameter, by passing in the parent selection, the dataset will get refreshed
I've been having the same issue, and realized it was a simple mistake causing this issue. Posting here for OP and anyone else searching for this issue.
You need to ensure that all parameters, in SSRS, are set to the correct value field, not the display field. You can replicate the cascading parameter issue that many have identified by simply selecting a "Name" field in the parameter default values instead of the "Value" field requested. This will populate the drop down correctly but nothing will be selected, and the cascade will stop. It may then appear as though the cascading parameters are not refreshing because of the Closed be Design issue.
In SSRS In Report Data tab, right click parameter and select
Parameter Properties.
Select Default Values.
Ensure that Value Field is set to the correct value for your sproc, not the value that you present to report users.

Crystal Reports V11 Showing different boolean values per machine

I'm getting a weird issue with Crystal - I have a basic report that displays records dependant on a boolean value ('open') being true. However, on some PCs it works fine, on others it just shows displays a blank report.
Having done a bit of checking into this, viewing the SQL query seems to indicate that there's an issue with how Crystal is interpreting the boolean value on different machines.
If we select 'Show SQL query' on each of the machines, the ones that don't work show the boolean section as:
`support`.`open`=1
The ones that work show:
`support`.`open`=.T.
...which seems more realistic due to the datasource being a VFP table via an ODBC driver.
I can't quite figure this one out - I suppose it's possible it's something to do with the ODBC driver. Does anybody have any clues as to why this might be happening?
Thanks
The boolean should be directly interpreted through the ODBC... I would change the query to just have
Where 'support.open'
If logical, it will only be .T. / .F. or true / false or 1 / 0... Let the ODBC handler handle it for you.
--- Edit via comment.
I wasn't referring to Crystal's report formula, but the query... But if thats the issue in Crystal, I would change the query that is RETRIEVING the data to be...
IIF( support.open, "YES", "NO " ) as ItemIsOpen
VFP OleDB / ODBC should recognize the IIF() and return the column to a string of "YES" or "NO " respectively... Then use the "ItemIsOpen" column in your report instead of the "support.open" column.