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.

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 5/4/2012 Copyright © 2005, 2012, Oracle. All rights reserved. Legal Notices.