mailtojustine Posted December 9, 2015 Share Posted December 9, 2015 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 ReportQuery part : where $X{IN, i.id, ProjectID}Parameter Name : ProjectID, Class : java.util.Collection, Nested Type : java.math.BigDecimalIn SubreportQuery part : where i.id=$P{ProjectID}Parameter name : ProjectID, Class : java.math.BigDecimalCan anyone please help me to resolve this problem? Thanks,Justine Link to comment Share on other sites More sharing options...
kkriplani Posted December 9, 2015 Share Posted December 9, 2015 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. Link to comment Share on other sites More sharing options...
mailtojustine Posted December 9, 2015 Author Share Posted December 9, 2015 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 pageMain report data P1, Sub report data P1, Sub report data P22nd pageMain report Data P2, Sub report data P1, Sub report data P2But, the desired result should be like this,1st pageMain report data P1, Sub report data P12nd pageMain report Data P2, Sub report data P2. Any idea for getting this result? Link to comment Share on other sites More sharing options...
mailtojustine Posted December 9, 2015 Author Share Posted December 9, 2015 "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. Link to comment Share on other sites More sharing options...
zh3ntil Posted December 9, 2015 Share Posted December 9, 2015 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. Link to comment Share on other sites More sharing options...
mailtojustine Posted December 10, 2015 Author Share Posted December 10, 2015 Thanks.. It worked. Link to comment Share on other sites More sharing options...
michael.pokorny Posted September 1, 2016 Share Posted September 1, 2016 I am experiencing this same issue right now. How did you finally resolve it? Thanks. Link to comment Share on other sites More sharing options...
sreerambabu.palaniswamy Posted September 20, 2016 Share Posted September 20, 2016 Hi Justine, How did you solve this issue, I'm also having the same issue? Thanks Sreeram Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now