Jump to content

Conditionally Change Text Colour


ian.waterman

Recommended Posts

Working only with the Studio I have added a Style using instructions I found on a previous post

1) Right click on styles >> Add >> Style
2) give it a forecolor
3) right click on style >> Add Conditional Style >> give a condition like below;

   $P{GroupField}="text"

For the field you want to apply the style, click on the field and in the property select the style.

In my case Colour is Red, existing field colour is black. Condtion  = $F{CRDR}.equals("Credit")

Condition works as I am using it in another expression to change Text shown

When I look in Source it has created style which I assume is OK

</style>
    <style name="Style1" forecolor="#FC052A" markup="none" fontName="DejaVu Sans" fontSize="11">
        <conditionalStyle>
            <conditionExpression><![CDATA[$F{CRDR}.equals("Credit")]]></conditionExpression>
            <style/>
        </conditionalStyle>
    </style>

When I apply the Style to my text field it appears to disappear from the Designer screen, and when I run report it is blank. If I remove style from text field text returns and when report runs the correct Black text is there.

Any suggestions as to what I am doing wrong or is there a step I have missed

Thank you

Ian

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...