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

2

Hello,

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.

Thanks

katherine.vierra's picture
Joined: May 22 2013 - 8:56am
Last seen: 1 year 4 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 sd.active = true order by sd.display_name"/>
<parameterDescription><![CDATA[]]></parameterDescription>
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
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>
</parameter>

Any suggestions are greatly appreciated.

ktalarico - 4 years 8 months ago

2 Answers:

0

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
44139
Joined: Apr 24 2010 - 4:31pm
Last seen: 1 month 4 days ago
-1

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
351
Joined: Feb 20 2013 - 11:39am
Last seen: 1 month 3 days 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 - 4 years 8 months 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 - 4 years 8 months ago

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

H Mendoza - 4 years 8 months ago
show 1 more...

Hi.

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?
Thanks!

jrodrigues_1 - 2 years 2 months ago
Feedback
randomness