Sunday, July 22, 2012

Simple senario with solution

I have the source table is
  Number
1
1
2
3
3
4



Target_unique                   Target_Duplicates
    2                                                   1
    4                                                   3




Procedure :


>  Drag the source twise in the mapping designer.
> Drag the targets on the mapping designer.
> Create Aggregrator Transformation take the number as input port and count number take as output port with the condition is count(number).
> Create the joinner transformation drag the number port from source2 and drag the all ports from the aggregrator transformation.
> The condition in joinner transformation is number1=number.
> Create the router transformation with two groups 
   *  Unique group have the condition is countnumber=1.
   * Duplicate group have the condition is countnumber>1.
> Link to the two targets.
> Create session and workflow.


CREATE THE SOURE TABLE AS

ID KITNO CODE
1  1      G1
2  2      G1
3  3      G1
4  4      G1
5  5      G2


TARGET TABLE IS 

ID KITNO CODE
1  4      G1
2  4      G1
3  4      G1
4  4      G1
5  1      G2



 Procedure is 

Drop the soure table twice in the mapping designer.
Drop the target table.
Create the aggregator transformation by the following logic
  1.Take kit no as input port.
  2. code as group by.
  3. create new port max count as output port with the condition is
     max(kit no).
Create the Normal joiner Transformation.
Drag the code and max count from the agg transformation.
Drag the id,kit no,code from the second source table.
create the condition in the joiner transformation code1=code.
Drag the ports from joiner transformation to target that are id,max count for kit no,code1 for code.
Create the session and work flow.                          

  


  Scenario - 2


Let say i have more than have record in source table and i have 3 destination table A,B,C. i have to insert first to 10 record in A then 11 to 20 in B 21 to 30 in c. Then again from 31 to 40 in A. 41 to 50 in B and 51 to 60 in c... so on up to last record.


Drag the source and target on maping desingner.
Create the exp transformations and copy the source ports to the exp transformation.
Double the exp trans and create new port seq_number.
Create the sequence generator transformation.
Link the nextvalue to the seq_number transfromation.
create Router transformation and drag the ports of exp transformation into router transoformation,
create the 3 groups and comming to logic is

Group1 = mod(seq_number,30) >= 1 and mod(seq_number,30) <= 10
Group2 = mod(seq_number,30) >= 11 and mod(seq_number,30) <= 20
Group3 = (mod(seq_number,30) >=21 and mod(seq_number,30) <= 29 ) or mod(seq_number,30) = 0
 

Connect the group one to first target,group two to the second target,third group to the third target.
Create the session and create workflow.



No comments: