Hi all,
I am having an input:
name,add,loc,pos
A,l,s,BA
A,l,s,CA
A,l,s,DA
i need to transform it to
name,add,loc,pos
A,l,s,BA/CA/DA
I tried to use stage variables but any help is appreciated.
Thanks
Sam
joining the common rows
Moderators: chulett, rschirm, roy
-
- Charter Member
- Posts: 822
- Joined: Sat Sep 17, 2005 5:25 pm
- Location: USA
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
Stage variables will do the trick as long as the data is sorted and partitioned by the key columns A,I,s. Stage variables can hold values from previous rows as long as you fire them in the right order.
Something like this:
NewKey=input.name:|:input.add:|:input.loc
Separator=IF NewPos<>"" THEN "/" ELSE ""
NewPos=IF NewKey=OldKey THEN Pos:Separator:input.pos ELSE ""
OldKey=NewKey
Something like this:
NewKey=input.name:|:input.add:|:input.loc
Separator=IF NewPos<>"" THEN "/" ELSE ""
NewPos=IF NewKey=OldKey THEN Pos:Separator:input.pos ELSE ""
OldKey=NewKey
Certus Solutions
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
-
- Charter Member
- Posts: 822
- Joined: Sat Sep 17, 2005 5:25 pm
- Location: USA