Total Pageviews

2014/12/16

Utilize Styles to Change Font Color Based on Condition in iReport

Problem
Customer ask us to change font color to red if the amount is less than zero.

It should look like this:


Solution
  • Step1. Move cursor to "Styles" and right click => Add => Style


  • Step2. Right click on "style1" => Add "Conditional Style"


  • Step3. Edit "Conditional Expression" ( apply this style if $F(amount) value is less than zero)


  • Step4. Set font color to RED


  • Step5. Owning to set font color to red, it will set line color to red as well. Hence, we need to set line color to black manually.


  • Step6. Click on $F{amount} and set "Style" to "style1" which we create and configure in Step2 ~ Step5.



No comments: