Jump to content
We've recently updated our Privacy Statement, available here ×

conditional-style + compare strings


basti1985

Recommended Posts

Hello i have a report with a conditional-style.
I have create a style and a condition but i can't get a condition that works.

First of all i have 2 database-columns (e.g. part, gender) and want to set the font-color to green if gender == man and red if gender == woman.

I try the following in a test where i have display both columns and set for the gender column this expression:

and try also other examples but the is no go has someone a idea?
 

Code:
$F{Field}.toString().matches("Men") -> no work$F{Field}.toString() == "Man" -> no work$F{Field} == "Man" -> no work
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

try this in your condition:

new Boolean($F{Field}.toString().equalsIgnoreCase("MAN"))

change the "Field" word properly with your field name.
if you have a String field you can remove the toString() function.

give us a feedback...

_________________________________________

if it works... give me KARMA points please!    : ) 
_________________________________________

listening: Muse - Plug In Baby [Live From Wembley Stadium]



Post Edited by slow at 08/31/2010 10:12
Link to comment
Share on other sites

  • 4 years later...

Email hola Una PREGUNTA quiero hacer Mismo Lo Que solista diferente mar de Lo Que declaro 

 

<style name="tipo_ut">

<conditionalStyle>
<conditionExpression><![CDATA[new Boolean ($F{TIPO_UT}.diferents("ejemplo"))]]></conditionExpression>
<style mode="Opaque" backcolor="#FF3131"/>
</conditionalStyle>
</style>

 

Link to comment
Share on other sites

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...