assignValueByCondition will passes a value from the third argument when the corresponding value from the first argument has one of the values contained in the second value (these conditions are separated by a semicolon); passes ResultList.SUPPRESS otherwise.
getFirstContextValue will returns the first non-empty context value or ResultList.SUPPRESS if no such value exists.
Source message type and target message type:
Source data and target data:
If source message col1 have value “C”, then copy corresponding col2 value “Code” to string1 at target message.
mapping for field list1 if constant is “C”:
AssignValueByCondition will use constant “C”, searched col1, and found matched, get corresponding value “Code” at col2. Other not matched will become SUPPRESS.
mapping for field list1 if constant is “X”:
assignValueByCondition will use constant “X”, searched col1, and none is matched, so all will become SUPPRESS.
deleteSuppress and mapWithDefault will turn SUPPRESS become empty string, to avoid run-time error. This is because string1 is mandatory field.
Target message string1 is empty string:
mapping for field list1 if constant is “C;E”:
assignValueByCondition will use constant “C;E”, splitted become 2 values “C” and “E”, searched col1, found 2 matched and get 2 corresponding values “Code” and “Encryption”.
Target message string1 is value “Code”. Value “Encryption” is not copied because string1 is only single value.
mapping for field list1 if constant is “C;E” and added function getFirstContextValue:
getFirstContextValue will ignore all SUPPRESS and only get first non-empty value, which is “Code”
UDFNodePool – assignValueByCondition and getFirstContextValue