Creating a cascading input control with a multi-select input control


I am using JasperServer 5.6.0 and iReport.  I am trying to create a cascading input control where the first input control (organization) is multi-select.   That input control seems to work properly.  The problem comes in when I try to create the 2nd level input control (unit).   

1st Level parameter = organization  (mult-select input control)

2nd Level parameter (cascading from organization) = unit  (multi-select input control)

This is the basic syntax I'm using for the query to populate the 2nd level (unit) input control.

select distinct UnitId, Name from Unit
where $X{IN,unit.unitorgid,organization}

When I execute the report on the server, I get no input controls.  When I look in the jasperserver.log, it is blank. I've tried restarting my services but doesn't seem to trigger any logging.  Hopefully someone can tell me what I'm doing wrong.


katherine.vierra's picture
Joined: May 22 2013 - 8:56am
Last seen: 4 years 8 months ago

I am having trouble with my 2nd level parameter.  I am hoping someone can correct my syntax.

My first parameter is single select and it works:

<parameter name="QUESTIONNAIRE NAME" class="java.lang.String">
<property name="parameter_type" value="select"/>
<property name="query" value="select distinct sd.display_name as displayName from srv_survey_definition sd where = true order by sd.display_name"/>
My second parameter is multi-select and it should reference first parameter. It is not retrieving any results:
<parameter name="DISPLAY NAME" class="java.util.List" isForPrompting="false">
<property name="parameter_type" value="multiselect"/>
<property name="query" value="select distinct display_name from srv_survey_definition where split_part(survey_name,'_OUTDATED',1) IN (select survey_name from srv_survey_definition sd where and sd.display_name = $P{QUESTIONNAIRE NAME})"/>
<defaultValueExpression><![CDATA[java.util.Arrays.asList(new String(" "))]]></defaultValueExpression>

Any suggestions are greatly appreciated.

ktalarico - 8 years 2 weeks ago

2 Answers:

I've found JasperReports Server input controls is OK for very simiple querying but found it to be very limited in functionalities to be useful in actual systems.

I had a situation where users wanted to enter multiple query fields, show results from the query, and then to select checkboxes on customers whom they wanted to generate a report. They also wanted all customers report to be generated in 1 single pdf file instead of a pdf file for each customer.

What I ended up doing was create a custom jsp page to do this.

hozawa's picture
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 5 months ago

Hi there - Try looking at the sample on the JasperReports Server, /reports/samples/Cascading_multi_select_report.  This is a good starting point.  The cascading input controls are tricky at first.  If you are not able to create, let me know.  

H Mendoza's picture
Joined: Feb 20 2013 - 11:39am
Last seen: 3 years 5 months ago

This did help. It's a bit quirky when the top level of a cascading input control is multiselect. The trick was in the query for the top level control. Previously I used.

Select uo.unitorgid as organization from unitorg uo

However, I descovered that the "as unitorgid" had to be changed to "as unitorg" since 'unitorg' is the id of the corresponding input control/parameter. I also had to put 'unitorg' as the value/display field for the input control. Previously when the organization control was single select, I used the database field name as the value field in the input control and it seemed to work fine.

katherine.vierra - 8 years 2 weeks ago

Where to find /reports/samples/Cascading_multi_select_report? I downloaded the Jasperserver and I don't see that in the reports/samples. Many thanks.

ktalarico - 8 years 2 weeks ago

Use the search feature to find it. The file is there.

H Mendoza - 8 years 2 weeks ago
show 1 more...


I can't find this sample either.
It been almost two years since the last activity on this thread, so maybe it is not included in Jasper Server anymore.

However, I'm struggling with the same OP's problem. Does anyone have this sample?

jrodrigues_1 - 5 years 7 months ago