christineolah Posted April 8, 2011 Share Posted April 8, 2011 Hello, I'm having trouble with the following variable expression in iReport:($V{CST_ELA_2}.intValue() != 2) ? (($V{CST_ELA_5}.intValue() == 5) ? 5 : 0) : 2 I have 2 integer variables CST_ELA_5 and CST_ELA_2.I just want to return the smaller of the two values, but I think null values are causing an issue. This expression is only returning values that meet the criteria of 5, otherwise the value is null. Any suggestions? Christine Link to comment Share on other sites More sharing options...
lknueve Posted April 8, 2011 Share Posted April 8, 2011 what about something like the following: $V{var1}.intValue() == null ? -> checks for null in first variable $V{var2}.intValue() == null ? -> checks for null in second variable 0 : $V{var2}.intValue() -> if both are null, send zero, else if only first is null send second variable : $V{var1}.intValue() >= $V{var2}.intValue ? -> check if first value is greater or equal $V{var1}.intValue() : $V{var2}.intValue() -> if first is larger or equal, return first variable, else return second 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