concatenate phone numbers with same customer id

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
jhansi
Participant
Posts: 33
Joined: Sat May 26, 2012 4:56 am

concatenate phone numbers with same customer id

Post by jhansi »

if the id is same for several records,then the phone numbers will concatenate.
how to do it with transformer or without using transformer

source
id,name,phone
1,abcd,7687656543
1,abcd,9876342123
2,bmp,6545365342
2,bmp,6575434566
3,xyz,9087878765

target
id,name,phone
1,abcd,7687656543,9876342123
2,bmp,6545365342,6575434566
3,xyz,9087878765

thnx in advance
jhansi
hanuman5
Participant
Posts: 7
Joined: Thu Jan 05, 2012 1:53 am
Location: india
Contact:

Post by hanuman5 »

the solution above scenario like this
source---->sort---->transformer---->target
sort the data based on id and provide key change column
in transformer take three stage variables
prevkey 0 integer 1
newaccnt 'n' char 1
accnts 'y' varchar 255

map key change to prevkey
if prevkey=1 then 'y' else 'n' to newaccnt
else
accnts:',':in.accnt
then accnts drag to phonenum
ANILKUMAR JAKKAMPUDI
jhansi
Participant
Posts: 33
Joined: Sat May 26, 2012 4:56 am

Post by jhansi »

thnx 4 ur reply.
but when i am giving in.accnt in accnts stage variable...
it is showing that 'in.accnts' column is not defined.what is this 'in.'
where to give this else condition
jhansi
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

Use the name of your input link and column. in.accnts and accnts are examples for you to modify.
- james wiles


All generalizations are false, including this one - Mark Twain.
jhansi
Participant
Posts: 33
Joined: Sat May 26, 2012 4:56 am

Re: concatenate phone numbers with same customer id

Post by jhansi »

i found the solution for this.

seqfile-->sort-->-->transformer-->remove duplicates-->dataset

in sort stage,set create key change column to true.
then u will get the required output
jhansi
Post Reply