如何在Hybris Jasper报告中使用灵活搜索字段type=“dynamic”?
例如:如何在Hybris Jasper报告中使用灵活搜索字段type=“dynamic”?,hybris,Hybris,例如: SELECT {adjustment.pk}, {reason.code}, {reason.description}, {adjustment.orderNumber} {adjustment.creator}, {cs.agentID}, {cs.mobilePhone} FROM {OrderValueAdjustment as adjustment JOIN AdjustOrderReason AS reason ON {adjustment.rea
SELECT
{adjustment.pk},
{reason.code},
{reason.description},
{adjustment.orderNumber}
{adjustment.creator},
{cs.agentID},
{cs.mobilePhone}
FROM {OrderValueAdjustment as adjustment JOIN AdjustOrderReason AS reason ON {adjustment.reason} = {reason.pk}
JOIN CsEmployee AS cs ON {adjustment.creator} = {cs.pk}
}
WHERE {adjustment.pk} = 8796093131124
抛出false,因为{adjustment.orderNumber}是动态属性类型。动态属性不是持久属性,因此无法使用flexi查询进行搜索。动态属性未保存在数据库中,因此无法使用FLexible Search获取它们 为了解决Jasper report的yur问题,如果您仔细查看jrxml文件salesByCountry.jrxml,例如,您将看到以下部分:
<queryString>
<![CDATA[SELECT x.COUNTRY AS COUNTRY, SUM(x.TOTPRICE) as TOTPRICE
FROM
({{
Select {country.name} as COUNTRY, COALESCE(sum({o.totalPrice} * {c2.conversion}/{c.conversion}),0) as TOTPRICE
from { Country AS country LEFT JOIN Address AS a ON {a.country}={country.PK} LEFT JOIN Order AS o ON {o.paymentAddress}={a.PK} LEFT JOIN Currency as c ON {o.currency}={c.PK} LEFT JOIN Currency as c2 ON {c2.pk}= $P{Currency} AND {o.creationtime} >= $P{From} AND {o.creationtime} < $P{To}}
GROUP BY {country.PK}, country
}}
UNION ALL
{{
Select {country.name} as COUNTRY, COALESCE(sum({o.totalPrice} * {c2.conversion}/{c.conversion}),0) as TOTPRICE
from { Country AS country LEFT JOIN Address AS a ON {a.country}={country.PK} LEFT JOIN Order AS o ON {o.paymentAddress}={a.PK} LEFT JOIN Currency as c ON {o.currency}={c.PK} LEFT JOIN Currency as c2 ON {c2.pk}= $P{Currency} AND {o.creationtime} >= $P{From} AND {o.creationtime} < $P{To} AND {o.paymentAddress} IS NULL}
GROUP BY {country.PK}, country
}}) x
GROUP BY COUNTRY
ORDER BY TOTPRICE DESC]]>
</queryString>
您可以做的是使用此灵活的按参数搜索替换数据检索,作为jrxml中的货币。然后,您只需从java中的模型中获取动态值,并使用参数映射将其传递给jasper报表。非常感谢您。那么,当jasper报表的属性是动态属性时,如何获取这些属性呢?