JasperStudio How to use conditional style?

孤者浪人 提交于 2019-12-02 15:49:31

问题


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 ?

Conditional Style

Thanks a lot in advance!

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>

回答1:


Assuming that $F{Revenue} is numeric (Integer, Double, Float ecc)

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"/>


来源:https://stackoverflow.com/questions/33588981/jasperstudio-how-to-use-conditional-style

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!