Page 1 of 1

Compare row then increase

Posted: Thu Mar 22, 2007 8:34 am
by kayarsenal
Hi,
Please how will I solve such a scenario?

I have a column A:


23434
45235
AB234
13443
12444
AB324
13443
AB324
12334

I want such an output

23434 1
45235 2
AB234 3
13443 3
AB324 4
13443 4
AB324 5
12334 5

Basically if column A[1,2]="AB" the number remains the same. I defined sth like this in stage var:

If Prev <> "AB" AND yyy.A[1,2] = "AB" Then xxx Else xxx +1 xxx(stage var 1)

yyy.A Prev(stage var 2)

This gives an output like this:

23434 1
45235 2
AB234 2
13443 3
AB324 3
13443 4
AB324 4
12334 5

Rgds,
K

follow up

Posted: Thu Mar 22, 2007 8:49 am
by kayarsenal
Thank you.Its already working. I noticed my mistake

Re: Compare row then increase

Posted: Thu Mar 22, 2007 8:51 am
by ag_ram
kayarsenal wrote:Hi,
Please how will I solve such a scenario?

I have a column A:


23434
45235
AB234
13443
12444
AB324
13443
AB324
12334

I want such an output

23434 1
45235 2
AB234 3
13443 3
AB324 4
13443 4
AB324 5
12334 5

Basically if column A[1,2]="AB" the number remains the same. I defined sth like this in stage var:

If Prev <> "AB" AND yyy.A[1,2] = "AB" Then xxx Else xxx +1 xxx(stage var 1)

yyy.A Prev(stage var 2)

This gives an output like this:

23434 1
45235 2
AB234 2
13443 3
AB324 3
13443 4
AB324 4
12334 5

Rgds,
K

U can use 2 sort stages , the first one will sort , the second one will produce a KeyChange . Then have a transformer , that looks for the key change field . Keep incrementing till then .it should work

Posted: Thu Mar 22, 2007 9:43 am
by ganesh123
Please mark the topic RESOLVED