hi All,
I have a requirement in which i have 10 keys columns and i need to perform vertical pivot conversion for the data.
Please suggest..
Here is the example
INPUT:-
AKey BKey CKey DKey EKEY FKEY GKEY HKEY IKEY JKEY SeqNoKEY ADD
1 2 11 a b c d e f g 1 A
1 2 11 a b c d e f g 1 P
1 2 11 a b c d e f g 1 P
1 2 11 a b c d e f g 1 L
1 2 11 a b c d e f g 1 E
OUTPUT:-
AKey BKey CKey DKey EKEY FKEY GKEY HKEY IKEY JKEY ADD
1 2 11 a b c d e f g APPLE
I tried using the using stage variables in transformer stage and passing to Remove duplicate stage and using the below logic
StgVarCurrent;- (AKey: BKey: CKey: DKey: EKEY; FKEY: GKEY: HKEY: IKEY: JKEY)
stgvarpervious:- StgVarcurrent
StgVarADD:- ADD
StgVarlogic- If StgvarCurrent<> StgVarPerious then StgVarlogic else StgVarADD:StgValogic
Please correct me if my logic is wrong and i am not getting the required output
Please note i have not used Seq_no anywhere in my logic
Thanks
if i have more than 10 keys columns to vertical pivot logic
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Charter Member
- Posts: 299
- Joined: Wed Nov 13, 2002 5:38 pm
- Location: USA
The order of the Stage variables is of paramount importance. The number of keys is not. If the order is as you've listed them above then the "IF" stage variable will never detect a key change. The "current" comes first followed by the stage variable that detects the key change and then the assign "current" to "previous" stage variable. It should be intuitive that your input data must be sorted in key(s) order as well.
Thanks to all,throbinson wrote:The order of the Stage variables is of paramount importance. The number of keys is not. If the order is as you've listed them above then the "IF" stage variable will never detect a key change. The "current" comes first followed by the stage variable that detects the key change and then the assign "current" to "previous" stage variable. It should be intuitive that your input data must be sorted in key(s) order as well.
Now the problem is that after sorting the data in the sorter stage i am not getting correct format data.
since i have 10key columns can i sort in any order. i mean key3 can i keep at keycolumn10 th position is it possible?
Please advice
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Charter Member
- Posts: 299
- Joined: Wed Nov 13, 2002 5:38 pm
- Location: USA