Distribution of Number of rows equally.

Hi all,
I have 100 rows in a table and want to distribute the data by 4 equal parts and write to four sequential file. here the source data keeps changing. Example : if source data is having 1000 rows the target files have to get 250 rows each in the four files.
1000/4 = 250 each
100/4 =25 each

Showing Answers 1 - 3 of 3 Answers

niel

  • May 11th, 2015
 

Step 1) When reading data from the sequential file take the Row number column this will provide you the number rows coming from the file.
Step 2) Create a stage variable in the transformer and give it value as X=max(row number column)/4.
Step 3) create four output links from the transformer and in the constraint page give contraints as:-
cosntraint a) 0 cosntraint b) (X*1)+1 cosntraint a) (X*2)+1 cosntraint a) (X*3)+1

  Was this answer useful?  Yes

Nish

  • May 25th, 2015
 

source-> Transformer->Target.
4 targets from Transformer stage.
Map the input to all the 4out put stages. now each link will have the following constraints respectively.
Link1 :Mod(@INPUTROWNUM,4)=0
Link2 :Mod(@INPUTROWNUM,4)=1
Link3 :Mod(@INPUTROWNUM,4)=2
Link4 :Mod(@INPUTROWNUM,4)=3
As long as metadata doesnt change this will distribute rows equally.

jallu

  • May 27th, 2015
 

read the data from sequential file and pass the through sample stage and put the 4 targets ,in sample stage set the properties percentage mode=25% we can get require output

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions