How to write iReport "if" expression?

0

I'm trying to make a report which generates a column call "name", by condition on the other column called "group". If "group" equals to "NULL",  insert 6 white spaces in front of its field "name", otherwise, keep "name" field unchanged.

I tried the following field expression on $F{name}. It doesn't work. Can somebody help please?

$F{group}== "NULL"? $F{name}.equals( "      $F{name}" )

Thank you in advance!

Ed.

edwarda's picture
Joined: May 6 2010 - 10:16am
Last seen: 8 years 10 months ago

2 Answers:

1

I think you have little problems with java...

try this:

field expression in a texfield that show filed "name":

$F{group}.equals("NULL")?"      "+$F{name}:$F{name}

 

This work if "group" field and "name" field are String field... and if group has a String value "NULL" not java null


 

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

 

(listening: Underworld - Juanita/Kiteless [Everything, Everything] )

slow's picture
891
Joined: Feb 17 2010 - 6:57am
Last seen: 9 years 1 month ago
0

Thank you for the tip!

It works now:

( $F{group} == null ?  "          " +$F{name} : $F{group} )

Yes. I'm very new to JAVA, a bit more than 1 month actually :-) Defintely, I'll vote you some Karma points! Really appreciate!

edwarda's picture
Joined: May 6 2010 - 10:16am
Last seen: 8 years 10 months ago
Feedback
randomness