Stage variable properties!!
Posted: Mon Sep 12, 2005 12:31 am
Hi,
I need to meet the following requirement.
cust_no telno skey_telno(generated output column in transformer )
1 12 1
1 23 2
1 NULL NULL
2 25 1
2 45 2
3 20 1
3 NULL NULL
Basically based on the input columns cust_no, telno
I need to generate skey_telno in the target table as shown above.
1) In the source stage i selected all the records order by cust_no, telno
2) In the transformer stage
In the stage variable pane:
Declare 2 stage variables tkey, tTemp.
tKey is initialized to 1, tTemp is initialized to NULL
step1:
If DSLink3.custno <> tTemp Then tkey=1 Else tkey+1
step2:
tTemp = DSLink3.custno
In the output link:
If IsNull(DSLink3.telno) Then '' Else tkey -> skey_telno
But the job results unexpected output...when new custno comes the stage variable starts with 0 rather than 1
Job output is:
cust_no telno skey_telno
1 12 1
1 23 2
1 NULL NULL
2 25 0
2 45 1
3 20 0
3 NULL NULL
is this is property of stage variable? can't it be reinitialized?
Please throw your thoughts.
Thanks
Madhav.
I need to meet the following requirement.
cust_no telno skey_telno(generated output column in transformer )
1 12 1
1 23 2
1 NULL NULL
2 25 1
2 45 2
3 20 1
3 NULL NULL
Basically based on the input columns cust_no, telno
I need to generate skey_telno in the target table as shown above.
1) In the source stage i selected all the records order by cust_no, telno
2) In the transformer stage
In the stage variable pane:
Declare 2 stage variables tkey, tTemp.
tKey is initialized to 1, tTemp is initialized to NULL
step1:
If DSLink3.custno <> tTemp Then tkey=1 Else tkey+1
step2:
tTemp = DSLink3.custno
In the output link:
If IsNull(DSLink3.telno) Then '' Else tkey -> skey_telno
But the job results unexpected output...when new custno comes the stage variable starts with 0 rather than 1
Job output is:
cust_no telno skey_telno
1 12 1
1 23 2
1 NULL NULL
2 25 0
2 45 1
3 20 0
3 NULL NULL
is this is property of stage variable? can't it be reinitialized?
Please throw your thoughts.
Thanks
Madhav.