Wednesday 16 October 2013

Transpose Columns To Rows Using Union Tranformation

This was a bit simple but comfusing question asked at the time of interview.

Scenario was like this..

We have a source - flat file or relational - having a single record as below

Source -- a,b,c,d,e,f,g
Target -- a,b,c,d
               e,f,g,h

Usually, after looking at requirement, it looks like tranposing rows to columns and the first things comes in a mind is use of Normalizer.

However, if we use normalizer, [ consiering occurance as 4, that is what you are thinking] result will be incorrect.

Solutions will be pretty simple which is as follows


As shown in above image, we just need one Union tranformation between Source Qualifier and Target.

We will create 2 groups in Union Tranformation as below -- having 4 ports each


As, shown in above image, we have created 2 groups having 4 ports each, which has converted 8 columns to 2 rows of four columns each.

No comments:

Post a Comment