convert rows in to column

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
synsog
Premium Member
Premium Member
Posts: 232
Joined: Sun Aug 01, 2010 11:01 pm
Location: Pune

convert rows in to column

Post by synsog »

How to convert rows in to column in 7x Parallel

Please help me

- Rams
ds@tcs
Participant
Posts: 24
Joined: Thu Mar 17, 2011 6:26 am
Location: chennai
Contact:

Re: convert rows in to column

Post by ds@tcs »

use pivot stage

import the source data,
give the target column names, then what ever the columns want to make rows,, map those columns to under required trg col
the data bill be added in row format
Regards
Sankar
synsog
Premium Member
Premium Member
Posts: 232
Joined: Sun Aug 01, 2010 11:01 pm
Location: Pune

Post by synsog »

it will not possible in pivot stage, we need to convert rows in to column
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It is possible. This is precisely what the Pivot stage does.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
synsog
Premium Member
Premium Member
Posts: 232
Joined: Sun Aug 01, 2010 11:01 pm
Location: Pune

Post by synsog »

Hi Ray,

thanks for you reply

Following is my requirement.

Source
=====

Col
===
1
2
3
4

target
=====

Col
===
1,2,3,4


source records count will vary, it will not same always.


thanks,
Rams
ds@tcs
Participant
Posts: 24
Joined: Thu Mar 17, 2011 6:26 am
Location: chennai
Contact:

Post by ds@tcs »

Hey Man it is possible with pivot stage..
i worked on that..
u try with the logic above what i mentioned ,
how many columns there maybe no problem it will convert..
you try and then tell me
Regards
Sankar
priyadharsini
Participant
Posts: 40
Joined: Mon May 11, 2009 12:19 am
Location: Madurai

Post by priyadharsini »

are you doing this based on any key olumn?
Last edited by priyadharsini on Fri Mar 25, 2011 3:29 am, edited 1 time in total.
priyadharsini
Participant
Posts: 40
Joined: Mon May 11, 2009 12:19 am
Location: Madurai

Post by priyadharsini »

All the records in a column has to be combined into a single record using the stage variables in transformer.

1. Create a dummy key column, sort and partition on that column.
2. In transformer use stage variables, one will store the current record and the stage variable will append the records.
e.g.
Input Column = Stagevariable
Stagevariable:stagevariable1=stagevaribale1
3. Use Remove duplicate and retain the last record.
Post Reply