Hello All,
My Goal
Create a iReport which takes begin_date, end_date and selected client names as input and returns the results.(I am trying to create a multi select list in iReport for the first time and facing difficulty in creating it.)
Steps of Approach
Database part
In Stored Procedure:
I created a stored procedure in my Ms Sql database, which takes 3 parameters as input. They are begin_date, end_date and client_list.
begin_date, end_date are simple datatime variables and
client_list is a varchar type variable, which takes list of comma separated names like '''abc'', ''def''' ..etc
My procedure has the code to parse each of comma separated string and collect the results for that date range for that client.
iReport Part
In my iReport, I opened "Report Query" window and selected the 'Query Language' as plsql
and created 3 New parameters (with same names as my stored proc.. just to be on the safe side)
begin_date, end_date and client_list respectively
Please check the below screen grab for the details.
My first issue is:
I am not sure how to fix the above error msg and
how to give an option to create and select multiple client names.
But - If I select a java.lang.string type I have no errors and my report seems to be working fine for default values, but not for the values that I give to client_list parameter at run time.
My second issue is:
How do I create a multi select list in iReport.
In Jasper Server
Next - I tried creating the same report in Jasper Server to see if I will have any luck
I uploaded the created iReport to my Jasper Server for Creating a new report.In Jasper admin, and created 3 Input Controls ( I am using exactly same names as my procedures input parameters)
Please check the below screen grab2
I defined Client Input control type as "Mult-Select List of Values" and defined my own list
Please check the below image
Now When I try to run this report, in Jasper Server ( or from iReport), I am getting the popup window as I expected, please see the below image
But when I run this by selecting the required parameters, I am getting big big errors as follow, may be because, my iReport did not complie properly, I am not sure how to create this kind of list in iReport or make this working. Please suggest. This is my first report with multi select list.
5 Answers:
I fixed it myself, It is all good now
I resolved this issue finally ... The reason why it was throwing error is
My iReport Langauge property is set to "Groovy" instead of "Java"
NOT in tools-> Options-> Language- Java
BUT for Language in Activity Report Properties ->Language ->Java (THIS IS THE CHANGE that resolved my issue)
Yes, sure you can put your all changes, also put your where condition in the query.
I changed my report completely and now this is where I stand
My client_list variable in iReport is a collection and is using something like this new ArrayList(Arrays.asList(new String[] {"test"}))
I changed my client_list variable name in Jasper Server to a "Multi-Select Query" and added the query and it is populating all the entries from the database (which is a good sign)
Now when I run the report, I am able select the begin_date, end_date and multiple clients
But When I click OK, I am getting the below error
I tried it all ready
and I did some more changes too.
still I am not able to execute the query in iReport using $X{} format