JasperStudio如何使用条件样式?
我非常想根据其值来格式化 FilmID字段。您能否为我提供一个条件表达式以将红色值> = 3格式化为红色?
I am desperately trying to format the Field "FilmID" based on it's value. Could you provide me with a conditional expression to format values >= 3 in red color ?
多谢!
这个问题的另一个变体是,我在这个表达式中做错了什么:
Another variant of this question would be, what did I do wrong in this expression:
<style name="Style1" mode="Opaque" backcolor="#DBD82A">
<conditionalStyle>
<conditionExpression><![CDATA[$F{Revenue} > 10000]]></conditionExpression>
<style mode="Opaque" backcolor="#C92B28"/>
</conditionalStyle>
</style>
假定 $ F {收入}
是数字(整数
, Double
, Float
ecc)
Assuming that $F{Revenue}
is numeric (Integer
, Double
, Float
ecc)
如果您使用的是jasper报告版本 6.0
或更高版本,则没有任何问题使用您的样式表达式,对于jasper报告 3.0
,您需要 new Boolean($ F {Revenue}> 10000)
if you are using jasper report version 6.0
or above there is nothing wrong with your style expression, for jasper report 3.0
, you need new Boolean($F{Revenue} > 10000)
in expression.
您还需要确保将样式应用于报表元素。
You need also to be sure that you apply the style to a report element.
<reportElement style="style1" x="49" y="4" width="100" height="20" uuid="865e11e4-c2d4-40ac-be06-dc1359dc93c0"/>