Posted: Thu Oct 25, 2007 6:03 am
If it is only ten columns. Try this in a transformer
In the inut column you should have two columns one should be key and other one is the column to be pivoted. Add zeros to input colmns and sort it in descending order
Stage Variables:
Source => Ans0:Space(5-Len(Ans0)):Ans1:Space(5-Len
(Ans1)):Ans2:Space(5-Len(Ans2)):Ans3:Space(5-Len
(Ans3)):Ans4:Space(5-Len(Ans4)):Ans5:Space(5-Len
(Ans5)):Ans6:Space(5-Len(Ans6)):Ans7:Space(5-Len
(Ans7)):Ans8:Space(5-Len(Ans8)):Ans9:Space(5-Len(Ans9))
KeyChange => If @INROWNUM=1 then 0 else If
Input_Lnk.KEYColumn= Currentkey then 0 else 1
Ans0 => 0
Ans1 => 1
.
.
.
Ans9 => 9
PrevKey => CurrentKey
CurrentKey => Input_Lnk.KeyColumn
[b]In out_Link => Constraint : KeyChange=1[/b]
Key_Column => PrevKey
Column1 = > Trim(Source[1,5])
Column2 => Trim(Source[6,5])
.
.
.
Till last column
In the inut column you should have two columns one should be key and other one is the column to be pivoted. Add zeros to input colmns and sort it in descending order
Stage Variables:
Source => Ans0:Space(5-Len(Ans0)):Ans1:Space(5-Len
(Ans1)):Ans2:Space(5-Len(Ans2)):Ans3:Space(5-Len
(Ans3)):Ans4:Space(5-Len(Ans4)):Ans5:Space(5-Len
(Ans5)):Ans6:Space(5-Len(Ans6)):Ans7:Space(5-Len
(Ans7)):Ans8:Space(5-Len(Ans8)):Ans9:Space(5-Len(Ans9))
KeyChange => If @INROWNUM=1 then 0 else If
Input_Lnk.KEYColumn= Currentkey then 0 else 1
Ans0 => 0
Ans1 => 1
.
.
.
Ans9 => 9
PrevKey => CurrentKey
CurrentKey => Input_Lnk.KeyColumn
[b]In out_Link => Constraint : KeyChange=1[/b]
Key_Column => PrevKey
Column1 = > Trim(Source[1,5])
Column2 => Trim(Source[6,5])
.
.
.
Till last column