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
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.
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?
Hi Justine,
How did you solve this issue, I'm also having the same issue?
Thanks
Sreeram