Jump to content
Changes to the Jaspersoft community edition download ×

multi-select input fails but single-select is fine


aaston

Recommended Posts

Hi there,

 

You must have had experience in trying to get your input controls work in both iReport and JS.

 

I have jrxml with SQL query embedded...I can run a report fine in iReport with input parameter prompted (although the input control itself is not a nice multi-select checkbox)

 

But in JasperSever, after I select multi-select checkbox input choices...I get the following error:

 

java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Set

 

Any idea in what cases that happens?

 

Thanks a lot guys,

Aston

 

Update 1: It turns out it works fine with various forms of single-select input controls...but if it's multi-select, I get the error like this above! Why does JS hate multi-select then?

 

Update 2 Problem solved. Should have changed the parameter from java.lan.string to java.util.Collection and in the SQL query set $X{IN, field name, parameter name). Thanks for the forum's old posts. Fancy telling someone to learn C++ programming without guide books/documentation! :((

Post edited by: aaston, at: 2008/06/20 13:24

Link to comment
Share on other sites

  • 3 weeks later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

How did you do it exactly? When I changed the parameter class type to java.util.Collection .... when I compile the report, it says "Cannot cast from Integer to Collection".

 

The multi-select is the only input type that I'm having trouble using .... and it is just what I need. Help please.

 

Thanks!

Link to comment
Share on other sites

benhur99ph,

 

It sounds like your param is a Collection, but you're trying to pass an Integer to it. Maybe as a default value.

 

Try something like one of these for your default value:

java.util.Arrays.asList(new java.lang.Integer[]{14, 129})

 

java.util.Arrays.asList(new java.lang.Integer[]{new java.lang.Integer(14), new java.lang.Integer(129)})

 

Regards,

Matt

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...