Wednesday, January 8, 2014

Conditional expression in ireport

Expression condition for the first in ireport for many usually seems awkward given that we have to leave behind our programming legacy of  IF ELSE and do it another way.

And here come the issue, suppose we have to define the following condition :

IF boolean condition THEN
 
     execute true code snippet
 
 ELSE
 
    execute false code snippet
 
 END IF
 
Ireport we will otherwise do it as follow:
 
 
( boolean condition ? execute true code snippet : execute false code snippet)
 
e.g:
 
if ( conVar > 0 )
     binVar= 1
 
else binVar= -1
 
Then becomes:
 
 (conVar > 0 ? binVar= 1: binVar=-1)

 
It the similar way we can express some complicated and nested conditions.
If you still face any problems feel free to drop a comment. 

No comments:

Post a Comment