Page 1 of 1

even records one target,odd number records one target

Posted: Mon Jun 28, 2010 8:25 am
by harikumar
i have source like
deptno,sal
1,2000
2,3000
3,4000
1,2300
4,5000
5,1100

i want target like

target1
deptno,sal
1,2000
3,4000
4,5000

target2
2,3000
1,2300
5,1100


with out using transformerstage

Posted: Mon Jun 28, 2010 8:53 am
by ArndW
Filter stage.

Posted: Mon Jun 28, 2010 9:20 am
by udayk_2007
using MOD (divide by 2) Function on dept column in modify stage,and followed by a filter stage should solve the problem.

Posted: Mon Jun 28, 2010 9:33 am
by asorrell
Please note that unless you set the job to process the data sequentially you are not going to get the output you expect - each node in the parallel job will grab odd / even records in your filter stage.

Posted: Mon Jun 28, 2010 10:25 am
by ArndW
Questions like this worry me. Either they are interview questions (which bothers me in any case) or someone is looking for a complicated solution to a simple problem. The transform stage would easily do this using @INROWNUM or, if parallel processing is being done, by @PARTITIONNUM + ( @NUMPARTITIONS * ( @INROWNUM -1 ) ) + 1 and two output links. Such a simple, efficient and clear solution to the request and yet the OP is asking to do it another way. Why?

Posted: Mon Jun 28, 2010 10:56 am
by laknar
have a stage variable Mod(AsInteger(input column),2)

i will retun 1 or 0

1=True means Odd rows
0=False Even records

in Constarint specify StageVar=1 in first link.

in Constarint specify StageVar=0 in second link.

Posted: Mon Jun 28, 2010 1:11 pm
by ArndW
lakNAR - he doesn't want to use a transform stage...

Posted: Mon Jun 28, 2010 5:17 pm
by kduke
I agree with Arnd, why?

Posted: Mon Jun 28, 2010 7:13 pm
by ray.wurlod
I agree with Kim, why?

If it's odds and evens, you could use a two-node configuration and round-robin partitioning, or you could use a single-node configuration and a Column Generator and a Filter stage.

Posted: Sun Sep 12, 2010 11:06 am
by varunndschange
If you want it to achieve without transformer ... First perform hash partitioning on deptno and sal and then you can use a row generator and generate rows for a new dummy column with initial value as 1 and increment by 1..
This way each row is assigned a unique value.. Now use filter stage and filter on the conditions as:
dummy_col%2<>0
dummy_col%2=0