如何在 $X{IN} 表达式中使用 sql 子字符串函数?
How to use sql substring function in a $X{IN} expression?
我在报告中有一个查询,在 $X{}
表达式中添加 substring
后无法正常工作。
SELECT t1.grn
FROM qc_master t1
WHERE $X{IN, t1.i_rep_no.substring(0,1), type}
我在 iReport/JSS 预览期间收到错误 Parameter 1 does not exist
。如何解决这个问题?
复制Jaspersoft Community的答案:
You cannot use an SQL function inside a JasperReports $X clause function as per: http://jasperreports.sourceforge.net/sample.reference/query/index.html#clause_functions
Instead, you could have something like this in your SQL:
and substr(t1.i_rep_no,1,1) IN ($P!{type})
with parameter type
as a java.lang.String
with comma separated values, or as anything that resolves to that.
我在报告中有一个查询,在 $X{}
表达式中添加 substring
后无法正常工作。
SELECT t1.grn
FROM qc_master t1
WHERE $X{IN, t1.i_rep_no.substring(0,1), type}
我在 iReport/JSS 预览期间收到错误 Parameter 1 does not exist
。如何解决这个问题?
复制Jaspersoft Community的答案:
You cannot use an SQL function inside a JasperReports $X clause function as per: http://jasperreports.sourceforge.net/sample.reference/query/index.html#clause_functions
Instead, you could have something like this in your SQL:
and substr(t1.i_rep_no,1,1) IN ($P!{type})
with parameter
type
as ajava.lang.String
with comma separated values, or as anything that resolves to that.