Issues with Passing Multi select parameter from main report to subreport

I have a main report from which parameter ProjectID is multi select. The main report is working fine. But after adding the subreport I am getting an error

"java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.math.BigDecimal"

In Main Report

Query part :  where $X{IN, i.id, ProjectID}

Parameter Name : ProjectID, Class : java.util.Collection, Nested Type : java.math.BigDecimal

In Subreport

Query part :  where i.id=$P{ProjectID}

Parameter name : ProjectID, Class : java.math.BigDecimal

Can anyone please help me to resolve this problem?

 

Thanks,

Justine

mailtojustine's picture
Joined: Oct 29 2015 - 6:01am
Last seen: 3 years 3 days ago

Hi Justine,

 

How did you solve this issue, I'm also having the same issue?

 

Thanks

 

Sreeram

 

 

sreerambabu.palaniswamy - 7 years 2 days ago

6 Answers:

You cannot cast two different classes for the same parameter in the same report. Thus declare it as collection in both the main and sub report.
Define ProjectID as bigdecimal and use the $X{IN, , } function in both the main and subreport.

This should solve your problem.

kkriplani's picture
5766
Joined: Sep 4 2015 - 2:18am
Last seen: 1 year 5 months ago

Thanks. Report is running in that case. But I am not getting the desired report output. Each time all the array list is passing to subreport. It is wrong.

Means, Suppose I am passing 2 Projects P1 and P2 as parameters from main report, the result now I am getting is,

1st page

Main report data P1, Sub report data P1, Sub report data P2

2nd page

Main report Data P2, Sub report data P1, Sub report data P2

But, the desired result should be like this,

1st page

Main report data P1, Sub report data P1

2nd page

Main report Data P2, Sub report data P2.

 

Any idea for getting this result?

 

mailtojustine's picture
Joined: Oct 29 2015 - 6:01am
Last seen: 3 years 3 days ago

"Define ProjectID as bigdecimal and use the $X{IN, , } function in both the main and subreport."

I tried this and still getting the same error. I think it is because from front end it is passing as multi parameter.

mailtojustine's picture
Joined: Oct 29 2015 - 6:01am
Last seen: 3 years 3 days ago

the report output seems normal if you send list or collection type parameter. Because each time of subreport execution, you send an array (P1,P2) to the subreport. Try to send 'id' field to subreport not the parameter. For example, id field holds P1 or P2.

zh3ntil's picture
3689
Joined: Nov 19 2014 - 11:02pm
Last seen: 7 years 2 months ago

Thanks.. It worked.

mailtojustine's picture
Joined: Oct 29 2015 - 6:01am
Last seen: 3 years 3 days ago

I am experiencing this same issue right now.  How did you finally resolve it?

 

Thanks.

michael.pokorny's picture
Joined: Jul 31 2015 - 7:12am
Last seen: 7 years 3 weeks ago
Feedback
randomness