SwitchCase Function

Number of input and output field

Number of input field : None
Number of output field : One

This transformation function is used to select a value based on if–else conditions. The conditions and their corresponding return values are stored in a Condition List, which is evaluated sequentially from the first element to the last.
If all conditions in the list evaluate to false, the default return value is assigned to the output.

The return value may be one of the following:

Constant Return Type
For the Constant return type, the return value can be specified using an interpolated string.
For example: Function Operation Return Type
For the Function Operation return type, you must provide a function operation class that extends the abstract class:com.labs247.function.SwitchCaseFunction247
Refer to the plug-ins tutorial for detailed instructions on creating a Function Operation for use in a Switch–Case transformation.

Building Switch–Case Expressions You can build a switch–case expression using either: When using a Free If–Then–Else Expression, certain reserved keywords must be taken into account.
Relational operators
NoSymbolDescription/MeaningNoSymbolDescription/Meaning
1==Equal13ILIn List
2!=Not Equal14NNIs Not Null
3<Less15NLIs Null
4>Greater16SWStarts With
5<=Less or Equal17EWEnds With
6>=Greater or Equal18NRIs Number
7EQEqual19NUIs Not Number
8NENot Equal20CLConstains List
9GTGreater21DTIs Date
10GEGreater Or Equal22LRIs Letter
11LTLess23MPMatchs Pattern
12LELess or Equal24CTLike (Content)


Logical operators
SymbolDescription/Meaning
ANDLogical And
ORlogical Or
NOTLogical Not

Sample of a free if-then-else expression :

    IF (UNIT<10) THEN
       IF (UNIT>=5) THEN "5 TO 9"
       ELSE "LESS THAN 5"
    ELSE
       IF (UNIT<=15) THEN "10 TO 15"
       ELSE "GREATER THAN 15" \n
   


    IF (UNIT LT 10) THEN
       IF (UNIT GE 5) THEN "5 TO 9"
       ELSE "LESS THAN 5"
    ELSE
       IF (UNIT LE 15) THEN "10 TO 15"
       ELSE "GREATER THAN 15"
   


The return value can be either a field’s content or the result of a function applied to a field’s content. The functions that can be applied to field content include: substring, Length, Concat, Prefix, PostFix, Upper, Lower, PrefixAndPostfix, LPad, RPad, ReplaceText, Trim.


Sample of a Free If–Then–Else Expression (with field-content and function-applied return values)

    IF (UNIT<10) THEN
       IF (UNIT>=5) THEN CITY 
       ELSE SUBSTRING(CITY,0,4) 
    ELSE
       IF (UNIT<=15) THEN DATE 
       ELSE ENC_AES256(DATE,"ABC") 
   


    IF (UNIT LT 10) THEN
       IF (UNIT GE 5) THEN CITY 
       ELSE SUBSTRING(CITY,0,4)
    ELSE
       IF (UNIT LE 15) THEN DATE
       ELSE ENC_AES256(DATE,"ABC")