Print      Open PDF Version of Online Help


Previous Topic

Next Topic

IIf

The IIf function in Expression Builder returns one of two parameters based on the evaluation of a conditional expression. IIf is an abbreviation for Immediate If.

Syntax

IIf(expr, result_if_true, result_if_false)

Alternate Syntax

IIf(expr, expr_if_true, expr_if_false)

Mixed Syntax

IIf(expr, result_if_true, expr_if_false)

IIf(expr, expr_if_true, result_if_false)

Result Type

The result type of the IIf() function is always the type of its first argument. If the expression evaluates to FALSE, the second argument is converted to the type of the first argument before its value is returned.

Arguments

The following table describes the arguments for the function.

Argument

Description

expr

The conditional expression that is to be evaluated.

result_if_true

The return value if the conditional expression evaluates to true.

result_if_false

The return value if the conditional expression evaluates to false.

expr_if_true

An expression to be evaluated if the conditional expression evaluates to true.

expr_if_false

An expression to be evaluated if the conditional expression evaluates to false.

NOTE: The language-independent field names and the field-name syntax used in any example expressions in this topic are the field names and the field-name syntax that were used in Expression Builder in releases earlier than Release 29 Service Pack 1. These examples are still valid. However, if you select the corresponding fields for an expression from the Fields list in Expression Builder in Release 29 Service Pack 1 or later, then the field names and the field-name syntax will be different from those shown in the examples. It is recommended that you always select the fields for your expressions from the Fields list in Expression Builder, so that the field names and the field-name syntax are always correct. For more information about the field names and the field-name syntax in expressions, see About Expressions.

Examples

The following is an example of mixed syntax in the IIf function:

A business process requires that the Region field on an account detail page is to be updated when the Billing State field is changed as follows:

If the Billing State field is changed to OK or TX, the region field is to be updated to Central. If the Billing State field is changed to CA, the Region field is to be updated to West. For all other states, the Region field is to be updated to East.

IIf([<PrimaryBillToState>]='OK' OR [<PrimaryBillToState>]='TX', 'Central', IIf([<PrimaryBillToState>]='CA', 'West', 'East'))

Related Topics

See the following topics for related Expression Builder information:


Published 1/9/2017 Copyright © 2005, 2017, Oracle. All rights reserved. Legal Notices.