Page 1 of 1

transformer stage problem

Posted: Thu Aug 26, 2010 8:25 am
by harikumar
hi my source is like

empno,sal
1,2000
2,4000
4,5000
3,6000
5,4500
6,3400

target is like

empno,sal,sequnum
1,2000,2
2,4000,4
4,5000,6
3,6000,8
5,4500,10
6,3400,12

plz tell me the clear logic for generate evennumbers and oddnumbers using transformer stage(stagevariables)

Posted: Thu Aug 26, 2010 8:34 am
by jsuryanathan
Include the below code in transformation stage.
svSeqNum=@inrownum*2

For 1st record it will be 2
2nd row 4
3rd row 6

This is applicable to above data. You can change little as per your requirement

Posted: Thu Aug 26, 2010 8:59 am
by anbu
From your input sequnum=empno*2.

I dont see any odd numbers in your sequnum. Can you pl explain your requirement?

Posted: Thu Aug 26, 2010 9:28 am
by kumar_s
Both even and Odd in same output?
Looks like you need continues Sequence number.
If you want it seperately. Make the data to run in two node.
Make the Partition as Entire.
Run a SequenceGenerator.
One node will give you odd number and other will give you Even number.
For the same set of data.

hi

Posted: Fri Aug 27, 2010 1:41 am
by harikumar
anbu wrote:From your input sequnum=empno*2.

I dont see any odd numbers in your sequnum. Can you pl explain your requirement?
hi for the same table one of the case i want to genrate oddnumers like

empno,sal,sequnum
1,2000,1
2,4000,3
4,5000,5
3,6000,7
5,4500,9
6,3400,11 like this please tell me the logic

Posted: Fri Aug 27, 2010 3:10 am
by rohithmuthyala
You can use a similar formula like, sequnum=(empno*2) - 1

Posted: Fri Aug 27, 2010 4:51 am
by ETLJOB
sequnum=(empno*2) - 1
I don't think "sequnum=(empno*2) - 1" would solve the purpose for the given sample data, considering the fact that employee number is not in sorted order.

I believe "sequnum=(@inrownum*2)-1" would do for you.

Posted: Mon Aug 30, 2010 1:26 am
by HariK
ETLJOB wrote:
sequnum=(empno*2) - 1
I don't think "sequnum=(empno*2) - 1" would solve the purpose for the given sample data, considering the fact that employee number is not in sorted order.

I believe "sequnum=(@inrownum*2)-1" would do for you.
"sequnum=(empno*2) - 1" will solve the problem whereas "sequnum=(@inrownum*2)-1" needs sorting for the data provided.