Conditionally displaying a <text>

I have to check the value of  a variable passed from java and then display data in  a text tag conditionally

I have set the java variable to a field as below:

<field name="myField" class="java.lang.String">
        <fieldDescription><![CDATA[myVariable]]></fieldDescription>
    </field>

I have to print "text1" when value of myFiled is "value1" or "value2". In all other cases i have to display "text2"

I tried using the below in my jrxml:

<text><![CDATA[($F{myField}.equals("value1") || $F{myField}.equals("value2"))?"text1":"text2"  ]]></text>

 

This is just displaying whatever is inside the CDATA as such. Someone please point out what I am doing wrong here.

susannamichael54's picture
Joined: Jan 9 2018 - 5:23am
Last seen: 5 years 4 months ago

0 Answers:

No answers yet
Feedback
randomness