动态传递参数到iReport 4.0.1

时间:2014-05-05 08:03:38

标签: sql jasper-reports

我正在使用iReport版本4.0.1。我的问题是

select productcategory as CATEGORYNAME,
    value as VALUE,m_product_id::text,
    product as NAME,count(pricexception) as stock 
from dtawm_stockcalculation_v
where m_product_id=$P{M_Product_ID} or $P{M_Product_ID} is null
    and productcategory=$P{M_Product_Category_ID} 
    or $P{M_Product_Category_ID} is null
group by value,m_product_id,product,productcategory 

我使用两个参数:$P{M_Product_ID}$P{M_Product_Category_ID}。在这里,我将两个参数的默认值设置为'%'但是我收到错误:

Cannot cast char to string.

1 个答案:

答案 0 :(得分:0)

通常我们使用“”来设置字符串类型参数的默认值。