Monday 18 July 2011

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.


Tuesday 12 July 2011

What is slowly changing Dimension?

Slowly changing dimension are dimension data, these dimensions increasing dimensions data with update existing dimensions.

Type1: Rows containing changes to existing dimensional are update in the target by overwriting the existing dimension. In the Type1 Dimension mapping, all rows contain current dimension data. Use the type1 dimension mapping to update a slowly changing dimension table when you do not need to keep any previous versions of dimensions in the table.

Type2: The Type2 Dimension data mapping inserts both new and changed dimensions into the target. Changes are tracked in the target table by versioning the primary key and creating a version number for each dimension in the table.Use the Type2 Dimension/version data mapping to update a slowly changing dimension when you want to keep a full history of dimension data in the table. Version numbers and versioned primary keys track the order of changes to each dimension.

Type3: The type 3 dimension mapping filters source rows based on user-defined comparisons and inserts only those found to be new dimensions to the target. Rows containing changes to existing dimensions are updated in the target. When updating an existing dimension the informatica server saves existing data in different columns of the same row and replaces the existing data with the updates.