sulalith Posted July 27, 2007 Share Posted July 27, 2007 Hi: I want to have a text field expression like "if ($V{cars}.equals(new String("BLACK"))) $V{carName}else if ($V{cars}.equals(new String("RED"))) $V{carMake}" You can one conditional expression but how can you have multiple conditional expressions for a text field expression. Thanks, Sulalith Link to comment Share on other sites More sharing options...
codyjasperForge Posted July 27, 2007 Share Posted July 27, 2007 Use nested ternary expressions: ($V{cars}.equals(new String("BLACK")) ? $V{carName} : ($V{cars}.equals(new String("RED")) ? $V{carMake} : ($V{cars}.equals("blue") ? $V{carModel}) : etc, etc, etc...) Link to comment Share on other sites More sharing options...
giroe Posted July 27, 2007 Share Posted July 27, 2007 Or make three textfiels on the same place and for the first textfield the print when expression: new Boolean($V{cars}.stringValue == new String("BLACK"))for the second texftield print when:new Boolean($V{cars}.stringValue == new String("RED")).....But codyjasperforge his solution is nicer I think :)mine is easier to understand (I think?)Post edited by: giroe, at: 2007/07/27 07:15 Link to comment Share on other sites More sharing options...
sulalith Posted July 27, 2007 Author Share Posted July 27, 2007 Hi: Thanks. Both solutions works. Sulalith Link to comment Share on other sites More sharing options...
sulalith Posted July 27, 2007 Author Share Posted July 27, 2007 Hi: Thanks. Both solutions works. Sulalith 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