AnsweredAssumed Answered

Split a column and concatenate with another column

Question asked by sukhminders608411 on Sep 7, 2017


I have 2 columns in my flat file. First column Col1 is a regular string field say contains "New Data" and the second one is Col2 which is a semicolon separated lists
e.g. A;B;C;D

My requirement is to create a new third column say Col3 which should be concatenation of Col1 and splitted values of Col2. So, in the aforesaid example, the value of
Col3 should be "New Data A, New Data B, New Data C, New Data D".

I tried achieving it by using User Defined Functions in a Map where I first split Col2 and then concatenated Col1 and the splitted values of Col2. But it throws error
in my User Defined Function i.e. SplitAndConcatenate as the Step 1 i.e. Split function returns 4 outputs and it's mapped to input parameter of Concatenate function
which is Step 2.
Error Message:
Test execution of RH-ProductFeed completed with errors. Embedded message: [Function: SplitAndConcatenate, String Split (Step 1)]: Invalid split, expected to have at
most 1 outputs but found 4. Input was A;B;C;D

Can someone spare some time and see how it can be done?

Sukhminder Singh