francia Posted July 21, 2007 Share Posted July 21, 2007 is possible to use logicals operator example >, =>, && in report expressions and conditions example else Thank you:unsure: Link to comment Share on other sites More sharing options...
slaisne Posted July 21, 2007 Share Posted July 21, 2007 Of course, as long as the result of the conditional expression is a Boolean Link to comment Share on other sites More sharing options...
jmurray Posted July 21, 2007 Share Posted July 21, 2007 You can create a Boolean expression like these examples: Variable myVar is a java.lang.String:new java.lang.Boolean( $V{myVar}.equals("hello world") ) Field myFld is (say) a java.lang.Integer:new java.lang.Boolean( $F{myFld}.intValue()>0 ) If you want to create an expression that actually performs an action based on a boolean comparison the you would do something like this: new java.lang.String( $P{myParm}.intValue()=0 ? "Zero" : $P{myParm}.toString() ) Link to comment Share on other sites More sharing options...
devibalan Posted July 21, 2007 Share Posted July 21, 2007 Hi What is the difference between $P{} and $P!{}?? thanks,Devi Link to comment Share on other sites More sharing options...
jmurray Posted July 22, 2007 Share Posted July 22, 2007 $P{} returns a quoted string like "hello", $P!{} returns an unquoted string like hello. Unquoted strings are very important when placing parameter values inline with (say) and SQL query. Take the following valid example: SELECT * FROM mytable WHERE mystringfield like '%$P!{someparametername}%' and compare it to the invalid example: SELECT * FROM mytable WHERE mystringfield like '%$P{someparametername}%' If $P{someparametername} = "hello" then the first statement's like value will be '%hello%' and the second example's like value will be '%"hello"%'. 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