Jump to content

put condition logic in ireport (jrxml)


jasperbox

Recommended Posts

I tried to find the samples on how to put the condition logic in ireport. Here's my problem:

I have the text fields field1 and field2, if the value of field1 is 'ADD', then I need to bold/italic the value of field2. Any ideas? Thanks in advance!

   <textField>
    <reportElement x="139" y="0" width="100" height="20"/>
    <textElement/>
    <textFieldExpression class="java.lang.String"><![CDATA[$F{field1}]]></textFieldExpression>
   </textField>
   <textField>
    <reportElement x="320" y="0" width="100" height="20"/>
    <textElement/>
    <textFieldExpression class="java.lang.String"><![CDATA[$F{field2}]]></textFieldExpression>
   </textField>

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

You can solve it using conditional styles. See in the jasper sample how the 'OrderIdStyle' was defined. Try to set the condition expression as follows:

<conditionExpression><![CDATA[boolean.valueOf("ADD".equals($F{field1}))]]></conditionExpression>

and then apply it to the second text field.

HTH,

sanda



Post Edited by shertage at 02/08/2011 07:52
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...