Jump to content
We've recently updated our Privacy Statement, available here ×

Variable Expressions


christineolah

Recommended Posts

 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

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...