Q: Cannot cast from String to Boolean i have 2 parameter which parameter class is : java.lang.String for:
query and pSalesType


query's default Expression is look like below:
(new String("all").equals($P{pSales_type}) ? "SELECT SALESMAN, SALES_AMOUNT, SALES_TYPE FROM (SELECT T1.SYS_USERNAME AS SALESMAN, SUM(REQ_SALES_AMOUNT) AS SALES_AMOUNT, 'Requisition' AS SALES_TYPE FROM t_requisition LEFT JOIN t_system_user T1 ON T1.SYSUSER_ID = T_REQUISITION.ENTERED_BY WHERE REQ_SALES_AMOUNT IS NOT NULL AND REQ_PROC_STATUS = 'Approved'  UNION ALL SELECT T1.SYS_USERNAME AS SALESMAN, SUM(WRO_SALES_AMOUNT) AS SALES_AMOUNT, 'Work Order' AS SALES_TYPE FROM t_work_order LEFT JOIN t_system_user T1 ON T1.SYSUSER_ID = t_work_order.ENTERED_BY WHERE WRO_SALES_AMOUNT IS NOT NULL AND WRO_APPROVAL_STATUS = 'Y' ) xx GROUP BY SALESMAN, SALES_TYPE " :
(new String("rq").equals($P{pSales_type}) ? "SELECT T1.SYS_USERNAME AS SALESMAN, SUM(REQ_SALES_AMOUNT) AS SALES_AMOUNT, 'Requisition' AS SALES_TYPE FROM t_requisition LEFT JOIN t_system_user T1 ON T1.SYSUSER_ID = T_REQUISITION.ENTERED_BY WHERE REQ_SALES_AMOUNT IS NOT NULL AND REQ_PROC_STATUS = 'Approved'" :
(new String("wo").equals($P{pSales_type}) ? "SELECT T1.SYS_USERNAME AS SALESMAN, SUM(WRO_SALES_AMOUNT) AS SALES_AMOUNT, 'Work Order' AS SALES_TYPE FROM t_work_order LEFT JOIN t_system_user T1 ON T1.SYSUSER_ID = t_work_order.ENTERED_BY WHERE WRO_SALES_AMOUNT IS NOT NULL AND WRO_APPROVAL_STATUS = 'Y'" :
"SELECT T1.SYS_USERNAME AS SALESMAN, SUM(REQ_SALES_AMOUNT) AS SALES_AMOUNT, 'Requisition' AS SALES_TYPE FROM t_requisition LEFT JOIN t_system_user T1 ON T1.SYSUSER_ID = T_REQUISITION.ENTERED_BY WHERE REQ_SALES_AMOUNT IS NOT NULL AND REQ_PROC_STATUS = 'Approved'")))

on the Report Query, i put like this:
$P!{query}


it able to load the field from database without any error.
SALESMAN
SALES_AMOUNT
SALES_TYPE

but when i preview it, it give the error: Cannot cast from String to Boolean

any idea to solve?

A: You need to put the else parts in extra paranthesis
(new String("all").equals($P{pSales_type}) ? "SELECT .... :
((new String("rq").equals($P{pSales_type}) ? "SELECT .... :
((new String("wo").equals($P{pSales_type}) ? "SELECT .....      ))

