Tuesday, December 11, 2012

Concatenation of duplicate value by comma separation

You have two columns in source table T1, in which the col2 may contain duplicate values.All the duplicate values in col2 of will be transformed as comma separated in the column col2 of target table T2.


Source Table: T1

Col1 Col2
a x
b y
c z
a m
b n



Target Table: T2

col1 col2
a x,m
b y,n
c z

Solution:

1. We have to use the following transformation as below.
First connect a sorter transformation to source and make col1 as key and its order is ascending. After that connect it to an expression transformation.


2. In Expression make four new port and give them name as in picture below.


3. In concat_val write expression like as describe bellow and send it to an aggregator


4. In aggregator group it by col1 and send it to target


5. Finally run the session.


…………..

1 comment:

Thank you :
- kareem