Page 1 of 1

creating sequence for a group

Posted: Tue Jan 19, 2010 9:38 pm
by dnat
Hi,

I have a requirement to create sequence numbers for each group

I have the following columns in the input

Col1-Col2-Col3-Col4

1111-2222-3333-444
1111-2222-3333-444
1111-2222-3333-444
1111-2222-3333-555
1111-2222-3333-555

So,

I have two groups now

One is
1111-2222-3333-444
The next is
1111-2222-3333-555

I want the output as

Col1-Col2-Col3-Col4-Seq

1111-2222-3333-444-1
1111-2222-3333-444-2
1111-2222-3333-444-3
1111-2222-3333-555-1
1111-2222-3333-555-2

How can i achieve this.

Posted: Tue Jan 19, 2010 9:42 pm
by ray.wurlod
Partition and sort your data with a Sort stage, generating a key change column. In a Transformer stage initialize a stage variable and use it
  • to reset the count to 1 if the key change column is 1

    to increment the count if the key change column is 0