Issue with Parameter

0

I have the following Parameter :
<parameter name="p_class_choice" class="java.util.Collection" nestedType="java.lang.String">
     <parameterDescription><![CDATA[]]></parameterDescription>
</parameter>

my Query :

SELECT sr.challenges Challenges,
pmp.CLASS Class,
prc.PRNAME ChargeCode,
sr.goodnews Goodnews,
sr.cop_report_date ReportDate,
iinv.NAME ProjectName,
iinv.CODE ProjectID
FROM niku.ODF_CA_COP_PRJ_STATUSRPT sr
LEFT JOIN niku.INV_INVESTMENTS iinv ON sr.ODF_PARENT_ID=iinv.ID
LEFT JOIN niku.PAC_MNT_PROJECTS pmp ON iinv.ID=pmp.ID
LEFT JOIN niku.PRCHARGECODE prc ON iinv.CHARGECODEID=prc.PRID
WHERE sr.cop_report_date >=$P{p_start_date}
AND sr.cop_report_date <=$P{p_end_date}
AND $X{IN, pmp.CLASS,p_class_choice}

I had the pmp.CLASS field sorted with "AND NOT pmp.CLASS in (abc,123,etc...) " prior.
Needed to make a multi select query for expanded reporting purposes.

Causes :

net.sf.jasperreports.engine.JRException: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map
at com.jaspersoft.studio.editor.preview.view.control.ReportControler.fillReport(ReportControler.java:468)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$18(ReportControler.java:443)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler$4.run(ReportControler.java:335)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map
at net.sf.jasperreports.engine.fill.JRFillSubreport.getParameterValues(JRFillSubreport.java:556)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateParameterValues(JRFillSubreport.java:429)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:409)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:307)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:259)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:456)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2067)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupHeader(JRVerticalFiller.java:649)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupHeaders(JRVerticalFiller.java:571)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:296)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:152)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:963)
at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFiller.run(BaseFillHandle.java:120)
at java.lang.Thread.run(Unknown Source)
 
Any thoughts?

 

camnott's picture
86
Joined: Mar 10 2017 - 6:24am
Last seen: 1 year 4 months ago

2 Answers:

1

So - This is a foolish mistake I made. Thank you for your answer Mariano, but I figured out what I was doing wrong.

When I was trying to pass parameters down to the sub report, I apparently mapped this parameter to the report by mistake, instead of passing it down.

When it tried to call the report, it was trying to map the parameter, throwing the error.

camnott's picture
86
Joined: Mar 10 2017 - 6:24am
Last seen: 1 year 4 months ago
1

Why do you use AND $X{IN, pmp.CLASS,p_class_choice} ?

Try AND $X{IN, pmp,p_class_choice} if it doesn't  try java.util.List instead Collection and be sure that pmp is String.

Mariano

mlopez_1's picture
910
Joined: Oct 21 2013 - 8:08am
Last seen: 22 hours 25 min ago
Feedback
randomness