Search This Blog

Monday, February 15, 2010

To Concatenate Two rows column data into a single column


Hi,
 If we want to concatenate two rows column data into a single column can be done by follwing
The source data is in this format
Affetected_areas, Coverage_comments, Claim_Id, Unit_Id
Garage,Test,1234-1,4567-1-2
Garage,Testing,1234-1,4567-1-2
Mall,To_Test,1234-1,4567-1-2 
The target data must be
Affetected_areas, Coverage_comments, Claim_id, Unit_id
Garage,Test;Testing, 1234-1, 4567-1-2
Mall, To_Test, 1234-1, 4567-1-2

To acheive this follow the below flow
SQ---->SRT----->EXP---->AGG--->TGT
 Sort the data according to the Affected_areas, Claim_Id, Unit_Id using sorter transformation
 In the expression transformation create four variable ports for Affected_areas, Claim_Id, Unit_Id and output port for the calculations. The Order is important
CC_Calc (VAR) -----> IIF(Affected_areas=AA_Prev AND Claim_Id = CI_Prev AND Unit_Id =    UI_Prev,CC_Calc||';'||Coverage_comments,Coverage_comments )
AA_Prev (VAR) ------> Affected_areas
CI_Prev (VAR) --------> Claim_Id
UI_Prev (VAR) --------> Unit_Id
OUT_CALC (OUT) ------->CC_Calc

Pass these values to the Aggregator Transformation group by the three ports and connect to the target the desired output is achieved.


No comments:

Post a Comment