Hi
I have the following requirement
Input Data:
a|1
a|2
b|2
b|3
Output Data
a|1,2
b|2,3
Transformation Rows to columns
Moderators: chulett, rschirm, roy
Transformation Rows to columns
Thanks
Pramod
Pramod
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Vertical Pivot
Hi,
Please design your job as follows,
sourcefile - (columnA,coulmnB)--->SortStage(sortby columnA) --Transformer-HashFile(ColumnA as Key)
In Transformer, define 5 stage variables,
sorted.test1 = NewVal
NewVal<>PrevVal = NotEqual
NewVal = PrevVal
sorted.test2 = Column2Val
If Not(NotEqual) then Column2:',':Column2Val else Column2Val = Column2
In the column derivation assign the stage variables to output columns,
sorted.test1 = Column1
Column2 = Coulmn2
Make Column1 as Key in hash file and run the job.
In case if you find any new logic do let us know.....
Regards
Ramesh
Please design your job as follows,
sourcefile - (columnA,coulmnB)--->SortStage(sortby columnA) --Transformer-HashFile(ColumnA as Key)
In Transformer, define 5 stage variables,
sorted.test1 = NewVal
NewVal<>PrevVal = NotEqual
NewVal = PrevVal
sorted.test2 = Column2Val
If Not(NotEqual) then Column2:',':Column2Val else Column2Val = Column2
In the column derivation assign the stage variables to output columns,
sorted.test1 = Column1
Column2 = Coulmn2
Make Column1 as Key in hash file and run the job.
In case if you find any new logic do let us know.....
Regards
Ramesh
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
That is a very limited solution, Ramesh. I suspect the OP showed us sample data, not the entire set.
In your design you already have the required result in the stage variables - why do you add a hashed file stage ?
In your design you already have the required result in the stage variables - why do you add a hashed file stage ?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.