4D v11 SQL now has a new command named CHOOSE.
The CHOOSE command is a replacement command for CASE Statements and IF conditionals. It will return the appropriate values based upon the criteria you specify. The CHOOSE command accepts booleans and numbers as criteria. It reduces the size of these statements to a single line.
-If a Boolean, Choose returns value1 if True and value2 if False. In this case, the command expects exactly three parameters: criterion, value1 and value2.
-If an integer, Choose returns the value whose position corresponds to criterion. Be careful, numbering of the values begins with 0 (the position of value1 is thus 0). In this case, the command expects at least two parameters: criterion and value1.
|vJob:=Choose([Person]Job;"CEO";"Software Engineer";"Starbucks Barista";"Comedian")|
This code is exactly equivalent to:
| Case of |