Thursday, December 14

Using The Iif Function in Place of ' If Then Else

Google+ Pinterest LinkedIn Tumblr +

The IIF function can replace an if-then-else statement in some cases. This function needs a true part and a false part, and must have an else statement. This function gets unwieldy for nested if statements. IIF is a VB function that is now included in both Crystal and Bask syntax. An IIF function takes three arguments: expression, miePart and false art.

”   The expression argument contains the condition that will evaluate either true or false. It corresponds to the “if” clause of an If expression-

•   The time part argument is the action to be executed when the expression evaluates to true. It corresponds to the “then” clause of an If expression. In this argument you can include single or range values, but no arrays.

•   The false Part argument is the action to be executed when the express-

•   Soon evaluates to false. It corresponds to the “else” clause of an If expression. It must be of the same type as true Part.

The following example illustrates usage of the IIP function.

lIF ((Orders.Order Araounll > 20000,  ‘Apply Discount”, “Standard Price”)

This formula returns the words Apply Discount if the order amount is greater than 20,000 and the words Standard Price for all other orders (that do not meet the1 greater than 20,000 condition).

Share.

About Author

Leave A Reply