0

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?

Community
  • 1
  • 1
TocToc
  • 4,739
  • 4
  • 29
  • 34
  • 1
    "input control seems to work properly in both environments" Input controls do not exist in iReport. Therefore it's not clear what you meant by this. – mdahlman Oct 23 '12 at 19:07
  • 1
    You have not given any indication about whether you see errors. If you do, what errors do you see? Maybe start with Tomcat's catalina.out log file. – mdahlman Oct 23 '12 at 19:08
  • @mdahlman: About input control: In iReport you can add an Input Control resource in the repository (right click on any folder) that is what I did. You also have the same possibility from the JasperReport Server web interface. Both are working for me: The input control is created and appearing on screen with the proper content. About the error: I get only the message "The report is empty". However hardcoding the selected value returns the data I expect. – TocToc Oct 24 '12 at 10:02
  • TocToc, have you defined these input controls as parameters in your report within iReport? When you right-click and add the input controls in the repository, you are actually adding them to JasperReports Server, not to iReport. – Lisa Oct 24 '12 at 15:06
  • I see. Yes, you can create the input control using JRS or iR. In either case it exists in JRS. And clearly it's not working. Does the parameter match (case sensitive) the input control? Post your parameterized query. – mdahlman Oct 24 '12 at 15:48
  • @Lisa : Good suggestion, but yes, I defined the parameter and it has the same name (case sensitive wise) than the input control id. I guess that if it was not the case, the report would not work in the preview. – TocToc Oct 25 '12 at 08:48
  • @mdahlman: See post above, yes it is case matching. – TocToc Oct 25 '12 at 08:48
  • Post your parameterized query. – mdahlman Oct 25 '12 at 16:36

2 Answers2

0

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 ;)

TocToc
  • 4,739
  • 4
  • 29
  • 34
0

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.