My Pages

Search This Blog

Friday, July 8, 2011

Multiples rows to single row

Can Consider both source and target as flatfiles or any relational source/target
Source
emp_name,emp_id  
siva,101 
sundar,101 
kumar,101 
satya,102 
lokesh,102
narra,102

Target
EmpID,FullName
101,Siva Sundar Kumar
102,Satya Lokesh Narra

Please share your solutions to others as comments

Cheers
-Winkey




Transform each row in to levels based on the the hierarchy id column

Consider source and target as flat files
Source:
child#  parent# hier#
1       2               10
2       3               10
3       4               10
4                       10
1       2               20
2                       20
1       2              30
2       3              30
3                       30
Target:
Lvl1   Lvl2   Lvl3   Lvl4
4       3       2       1
2       1
3       2       1

Case 1
Here maximum we have 4 levels
Case 2
We don't know the number of level(Hint:- Try to use JAVA transformation to find the Maximum level), means a for each hierarchy number(heir#) we can have n numbers of levels

Please share your solutions to others as comments

Cheers
-Winkey

A Column having multiple values to separate rows

Here consider the source and target as flatfiles
Source
id area
1 123,456-234,245,000
2 456,123,567-123,090
3 586,789,567-123,234

Target
id|area
1|"123"
2|"456"
3|"586"
1|"456-234"
2|"123"
3|"567"
1|"245"
2|"567-123"
3|"789"
1|"000"
2|"090"
3|"967-423"

Please share you solutions to others as comments



Cheers
-Winkey