babarincairo Posted November 7, 2006 Share Posted November 7, 2006 Hi, I have a problem with concatenation of two strings (from query) in a textfield. I want to concat string A and B with a " - " between them. The "-" is present only if B is not NULL. I use the following expression in the textfield : Code:(!($F{A}.equals(null)) ? $F{A} : ""«») +(!($F{B}.equals(null)) ? " - " + $F{B} : ""«») But it doesn't work. If B is NULL, nothing is printed (normally A must be printed). Can you help me ?ThanksPost edited by: babarincairo, at: 2006/11/07 08:25 Link to comment Share on other sites More sharing options...
jpasquier Posted November 7, 2006 Share Posted November 7, 2006 I think that the following code will work : Code:($F{A} == null ? "" : ( $F{B} == null ? $F{A} : $F{A} + " - " + $F{B} )) Link to comment Share on other sites More sharing options...
babarincairo Posted November 9, 2006 Author Share Posted November 9, 2006 the folloling code is working ($F{NOT_zone1}) + ($F{NOT_zone2} == null ? "" : " - " + $F{NOT_zone2}) + ($F{NOT_zone4} == null ? "" : " - " + $F{NOT_zone4}) + ($F{NOT_zone5} == null ? "" : " - " + $F{NOT_zone5}) + ($F{NOT_zone6} == null ? "" : " - " + $F{NOT_zone6}) Link to comment Share on other sites More sharing options...
DerGuteMoritz Posted December 28, 2006 Share Posted December 28, 2006 Everyone, this is the only solution for that issue? Can't this be simplified using Groovy? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now