IIf Function

Official Content
This documentation is valid for:

Scope

Objects: Procedures, Transactions, Web PanelsWork Panels
Languages: .NET, Java, Ruby (up to GeneXus X Evolution 3), RPG, Visual FoxPro (up to GeneXus X Evolution 3), Cobol

Purpose

Assigns a value depending on the evaluation of an expression. IIf is an abbreviation for Immediate if.

Syntax

IIf (Expression, TruePart, FalsePart)

Where:

Expression
  
The returned value is of Boolean type. It is the expression you want to evaluate. Expression can be a formula, a Udp, etc.

TruePart
   Return value if the evaluation of  Expression is True.

FalsePart
   Return value if the evaluation of  Expression is False.

Example

This example uses the IIf function to evaluate if &PageName1 is not equal to &PageName2.

&PageNameChanged = iif(&PageName1 <> &PageName2, true , false)

It is exactly the same to:

if &PageName1 <> &PageName2
   &PageNameChange = 1
else
   &PageNameChange = 0
endif

See Also

If Command