i
This is not the latest version of this document; to access the latest version, click here.
Official Content

To perform a set of commands depending on the condition.

Syntax

Do case
{Case cond
        block1}…
Otherwise
       block2
EndCase

Where:
cond
   Condition evaluated in the case.

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

Otherwise clause

Establish a final alternative in case all previous conditions are not matched.

The Otherwise operator is often used in Expression Formulas as a final alternative in case all previous IF conditions are not matched. The alternative value is the value indicated to the left of the OTHERWISE operator. This value must coincide with the attribute's definition.

Description

Any type of conditions can be used involving attributes and/or variables. The first Case whose condition is satisfied will be executed, and none of the others will be executed. In case all other Case conditions evaluate to false, then the commands specified under Otherwise are executed. It works in the same way if/else work.

Note

In Smart Devices, only the Start, Refresh and Load events support this command. As from GeneXus 15 is available in client-side events too.

Scope

Objects Procedure object, Transaction object, Web Panel object, Work Panel objectWork With pattern and Work With objectPanel object
Languages  .NET, Ruby, Java, RPG, Visual FoxPro, Cobol
Platforms Web, Win, Android, iOS, BlackBerry

 

See also

Sub command




Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant