Edit

If (condition, result1, result2)

Result Type: depends on parameters

Definition: If condition is “true”, returns the value of result1, otherwise returns the value of result2. Condition may be a Boolean value or a numeric value. A numeric value is considered to represent “true” if it is not zero. Result1 and result2 do not have to be of the same type.

Examples:  If(6 > 5, "Normal Universe", "Start Worrying")

should return “Normal Universe”.

If(Transaction.Gross >= 0, "Invoice", "Credit Note")

returns “Invoice” or “Credit Note” depending on whether Gross is positive or negative.

Note:  It is important to realise that this is just a function; It is not a flow-control construct. Thus, all parameters will be evaluated, regardless of the truth value of the first parameter. Thus

=if(X <> 0, Mod(10, X), 0)

will always give a divide-by-zero error if X is 0. To work around this, use the Val function to “defer” evaluating the parameter:

=val(if(X <> 0, "Mod(10, X)", 0)

This avoids ever trying to take a Modulo 0.