If Command

Official Content
This documentation is valid for:

To execute a block of commands if the condition evaluates to true.

Syntax

If cond
       block1
[Else
       block2]
EndIf

Where:
cond
   Condition evaluated in the If.

blockx
   Blocks that are executed if condition respectively evaluates to true or false.

Description

This group of commands allows you to condition the execution of command blocks.

Any command can be defined within block1 and block2 respectively.

Example

If &option = 4
    DelClient.Call()
Else
    Return
EndIf

Smart Devices objects

When using if command in a Panel for Smart Devices object or a Work With for Smart Devices there is a restriction for the cond syntax. It only can be a variable, attribute or SDT element of Boolean Data Type

Scope

Objects: Procedure object, Transaction object, Web Panel objectWork Panel object Panel for Smart Devices object Work With for Smart Devices object
Languages: .NET, Java, Ruby (up to GeneXus X Evolution 3), RPG, Visual FoxPro (up to GeneXus X Evolution 3), Cobol