My Pages

Search This Blog

Friday, July 8, 2011

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

No comments:

Post a Comment