Hi
I want to convert data from rows to columns for same key value .It can have N number of values .
Input
Key
1 a
1 b
1 c
1 to N
Output
1 ac
I cannot use vertical pivot because I dont know array size.
I also tried to transformation loop with loopvar <= MAX(COUNT) .But it is looping same value
Can you share your ideas
thks
vertical pivot
Moderators: chulett, rschirm, roy
You would use Transformer Looping to go the other direction, columns to rows. This is transformer concatenation and Remove Duplicates, retaining the last duplicate.
Edited to clarify the fact that by 'aggregation' I meant aggregate the values in the transformer via concatenation, not the stage of the same name.
Edited to clarify the fact that by 'aggregation' I meant aggregate the values in the transformer via concatenation, not the stage of the same name.
Last edited by chulett on Sat Apr 26, 2014 7:54 am, edited 2 times in total.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Reply
Transformer : Key hash partition sort ascending
Value (a,b,c etc) No partition Sort only ascending
Stage Variables :
svValue : if svKey = Input.Key then svValueOld:':':Input.Value else Input.Value
svKey : Input.Key
svValueOld : svValue
Then Remove Duplicate stage with Same partition.
Key : Key Duplicate to retain : Last.
Value (a,b,c etc) No partition Sort only ascending
Stage Variables :
svValue : if svKey = Input.Key then svValueOld:':':Input.Value else Input.Value
svKey : Input.Key
svValueOld : svValue
Then Remove Duplicate stage with Same partition.
Key : Key Duplicate to retain : Last.
Re: Reply
You only need two as there's no need to save the 'old' value, just the key:ssnegi wrote:Stage Variables :
svValue : if svKey = Input.Key then svValueOld:':':Input.Value else Input.Value
svKey : Input.Key
svValueOld : svValue
Code: Select all
svValue: if Input.Key = svKeyOld then svValue:':':Input.Value else Input.Value
svKeyOld: Input.Key
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers