Page 1 of 2
even-odd data
Posted: Wed Dec 02, 2009 11:08 pm
by datastageforum@yahoo.com
i want to capture even no. data in one file and odd no. data in another file,which one stage we will use and what properties we need to set?
Can we do it by filter stage if yes then what properties we need to set?
Posted: Thu Dec 03, 2009 12:52 am
by gssr
Hope this will help,
1.Use Column Generator to generate a sequence
2.Use a stage Variable to get the MOD of the column divided by 2
3.Use Constraints to seperate the zero and Non-Zero value of the Stage Variable
Try this and post the feedback
Posted: Thu Dec 03, 2009 12:54 am
by gssr
Hope this will help,
1.Use Column Generator to generate a sequence
2.Use a stage Variable to get the MOD of the column divided by 2
3.Use Constraints to seperate the zero and Non-Zero value of the Stage Variable
Try this and post the feedback
Posted: Thu Dec 03, 2009 1:18 am
by kamalshil
You can use same above technique and instead of Row generator for sequence you can use @INROWNUM system variable.
Posted: Thu Dec 03, 2009 2:07 am
by ray.wurlod
Even easier, use Modulus partitioning on a two-node configuration (or node pool) and have the Sequential File stage write two files.
Posted: Thu Dec 03, 2009 2:50 am
by datastageforum@yahoo.com
can we do it by filter also?
is there any modulus function in transformer.plz tell me in detail
Posted: Thu Dec 03, 2009 2:52 am
by datastageforum@yahoo.com
can we do it by filter also?
is there any modulus function in transformer.plz tell me in detail
Posted: Thu Dec 03, 2009 2:55 am
by datastageforum@yahoo.com
can we do it by filter also?
is there any modulus function in transformer.plz tell me in detail
Posted: Thu Dec 03, 2009 3:20 am
by srinivas.g
use stage variable like s=if(@inrownummond2=0) then '0' else '1'
Take two links first link constrsaiant is s=0(even data)
second link constariant is s=1 (odd data)
Posted: Thu Dec 03, 2009 3:37 am
by datastageforum@yahoo.com
is there any option in filter stage by that we can seperate even and odd number data
Posted: Thu Dec 03, 2009 3:45 am
by gssr
make it a Clear post!!
Do you want filter the records with respect to the VALUES in the column or the sequence of the records?
Posted: Thu Dec 03, 2009 3:49 am
by datastageforum@yahoo.com
Mr.GSSr i thnk u didn't get the question i want even records in one file and odd records in one file?is it possible to do it by filter or not if yes then how??
Posted: Thu Dec 03, 2009 4:20 am
by gssr
Have you tried the solutions given?
Posted: Thu Dec 03, 2009 5:17 am
by Sreenivasulu
Hi datastageforum guy
Its not proper to put two question marks in your question.
You are the person in need. Be humble. Its a free forum and no-one pays for answering your question
Regards
Sreeni
Posted: Thu Dec 03, 2009 5:20 am
by vinsashi
Hi,
transformer stage varible part
Code: Select all
declare first two stage varibles in trasnformer
a=@inrownumber(from system varible you wil get)
b=if mod(a,2)=0 then 'even' else 'odd'( you wil get mod operator in functions--->mathematical )
constraint
Code: Select all
in the first constraint give
b='even'
in the second constraint give
b='odd'
give two out putlinks
Thanks
vin..