Evaluates a given argument and returns one value when the argument is true and another when the argument is false.
If( [Condition], [ValueIfConditionIsTrue], [ValueIfConditionIsFalse] )
Condition is any rule which, when calculated, returns either TRUE or FALSE.
ValueIfConditionIsTrue is a rule or value which is returned if the condition, when calculated, returns TRUE.
ValueIfConditionIsFalse is a rule or value which is returned if the condition, when calculated, returns FALSE.
Rule | Meaning |
---|---|
If(FormSpinButtonReturn<=5, "Can be shipped in one container","Will be shipped in several packages.") | Checks the return value from a spin button called FormSpinButton, and if the result is less than or equal to five, returns "Can be shipped in one container". |
Operator | Meaning |
---|---|
< | Checks to see if the value on the left hand side of the operator is less than the value on the right hand side, and if so, returns TRUE, otherwise returns FALSE. |
<= | Checks to see if the value on the left hand side of the operator is less than, or equal to, the value on the right hand side, and if so, returns TRUE, otherwise returns FALSE. |
> | Checks to see if the value on the left hand side of the operator is greater than the value on the right hand side, and if so, returns TRUE, otherwise returns FALSE. |
>= | Checks to see if the value on the left hand side of the operator is greater than, or equal to, the value on the right hand side, and if so, returns TRUE, otherwise returns FALSE. |
<> | Checks to see if the value on the left hand side of the operator is not equal to the value on the right hand side, and if so, returns TRUE, otherwise returns FALSE. |
= | Checks to see if the value on the left hand side of the operator is the same as the value on the right hand side, and if so, returns TRUE, otherwise returns FALSE. |
Multiple If statements can be nested so many conditions can be evaluated. In these cases the syntax of the single If statement is substituted for one of the conditions, as below:
If( [ ConditionA], [ ValueIfConditionAIsTrue], If( [ ConditionB], [ ValueIfConditionBIsTrue], [ ValueIfConditionBIsFalse] ) )
If statements are always evaluated from left to right. So in the example above
The And and Or functions can be nested in place of the Condition argument. In these cases the syntax of the And/Or function replaces the Condition portion of the If statement. For example:
If( And ( [ LogicalExpression1], [ LogicalExpression2] ) , [ ValueIfConditionIsTrue], [ ValueIfConditionIsFalse] )
When using And
If( Or ( [LogicalExpression1], [ LogicalExpression2] ) , [ ValueIfConditionIsTrue], [ ValueIfConditionIsFalse] )
When Or