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:
- A constant
- A field operation
- A calculation operation
- A function operation
Constant Return Type
For the Constant return type, the return value can be specified using an interpolated string.
For example:
- An expression such as "foo ${bar}" inserts the value of the field bar, converted to a string, in place of ${bar}.
- An expression such as ${field_name} is replaced with the value of the field field_name.
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:
- Expression Builder, or
- Free If–Then–Else Expression
When using a Free If–Then–Else Expression, certain reserved keywords must be taken into account.
Relational operators
| No | Symbol | Description/Meaning | No | Symbol | Description/Meaning |
| 1 | == | Equal | 13 | IL | In List |
| 2 | != | Not Equal | 14 | NN | Is Not Null |
| 3 | < | Less | 15 | NL | Is Null |
| 4 | > | Greater | 16 | SW | Starts With |
| 5 | <= | Less or Equal | 17 | EW | Ends With |
| 6 | >= | Greater or Equal | 18 | NR | Is Number |
| 7 | EQ | Equal | 19 | NU | Is Not Number |
| 8 | NE | Not Equal | 20 | CL | Constains List |
| 9 | GT | Greater | 21 | DT | Is Date |
| 10 | GE | Greater Or Equal | 22 | LR | Is Letter |
| 11 | LT | Less | 23 | MP | Matchs Pattern |
| 12 | LE | Less or Equal | 24 | CT | Like (Content) |
Logical operators
| Symbol | Description/Meaning |
| AND | Logical And |
| OR | logical Or |
| NOT | Logical 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")
|