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:
assignValueByCondition_MT
Source data and target data:
If source message col1 have value “C”, then copy corresponding col2 value “Code” to string1 at target message.
assignValueByCondition_data
 
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.
assignValueByCondition_string1_C
 
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.
assignValueByCondition_string1_X
Target message string1 is empty string:
assignValueByCondition_string1_X_target
 
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”.
assignValueByCondition_string1_C_E
Target message string1 is value “Code”. Value “Encryption” is not copied because string1 is only single value.
assignValueByCondition_string1_C_E_target
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”
assignValueByCondition_string1_C_E_getFirstContextValue

UDFNodePool – assignValueByCondition and getFirstContextValue

Leave a Reply

Your email address will not be published. Required fields are marked *