To perform a set of commands depending on the condition.
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.
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.
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.
In Smart Devices, only the Start, Refresh and Load events support this command. As from GeneXus 15 is available in client-side events too.
Objects |
Procedure object, Transaction object, Web Panel object, Work Panel object, Work With pattern and Work With object, Panel object |
Languages |
.NET, Ruby, Java, RPG, Visual FoxPro, Cobol |
Platforms |
Web, Win, Android, iOS, BlackBerry |
Sub command