bigelo Posted April 15, 2007 Share Posted April 15, 2007 Hello. I am new with IReport so I hope that sb can help me. How is it possible to use conditions in IReport. Example: I have two parameters. "Param1" is boolean and "Param2" is a String.Now I only want that the value of Param2 is shown in the report only when Param1 ist true!!! (Sounds very simple ;) ) How can I do this (textfield expression)? Thx a lot Link to comment Share on other sites More sharing options...
kaunietiss Posted April 23, 2007 Share Posted April 23, 2007 Code:Param1 ? Param2 : "" Link to comment Share on other sites More sharing options...
redwine Posted April 23, 2007 Share Posted April 23, 2007 bigelo, Use the IF-ELSE ternary operators: Code:condition ? statement1 : statement 2 Explanation:IF condition is true, statement1 is executedELSE statement2 is executed. The statement given by kaunietiss is exactly the way you should interpret the example you gave.Code:[code]Param1 ? Param2 : "" The statement above has the same effect as... Code:[code](Param1 == TRUE) ? Param2 : "" You normally would use this in Print when expression.You could also use the statement in the middle of static text or in a text field.This is very useful as you most likely will need it in many of the reports that you will be making. Edwin Link to comment Share on other sites More sharing options...
redwine Posted April 23, 2007 Share Posted April 23, 2007 sorry... double post.:blink:Post edited by: edwin, at: 2007/04/23 14:30 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