Skip to main content

Rank Transformation in Informatica


Active Transformation.

Used to seek the position (at which position the data is).

We can see top or bottom positions.

By default, rank index port name is created along with the transformation object (To carry the rankings – rank index is prepared).


Ports:

Input
Output
Expression
Variable
Rank
Group-By

Steps:
1. Define the Source Definition (EMP).

2. Define the Target Definition.

How to Define the Target Table?



1. Go to Ware House Designer create a target table same as the source (EMP) by dragging and dropping the source definition.

2. Edit EMP source definition. Go to the Table tab of Edit and rename it to DIM_RANK.


Now go to the Columns tab and add a new column RANKINDEX and click Apply, then OK.



Till now the new table Dim_RANK is logically present in the WareHouse. 


SQL> select * from tab;

TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
DIM_EMP                        TABLE
DIM_EMP1                      TABLE

To make it available physically go to the Targets Menu and click on Generate/Execute SQL.




Click on Connect button.
Give the DSN, Username and Password of the Target.

Click the radio button Generate from Selected Tables , check the box Create Table.
Click Generate SQL file and the Close.



SQL> select * from tab;

TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
DIM_EMP                        TABLE
DIM_EMP1                       TABLE
DIM_RANK                     TABLE

Note that DIM_RANK now physically belongs to the Schema DWH_MEEN.

Define the mapping by dragging the source and target. Create a RANK Transformation T_RANK.



By default a RANKINDEX column is there in the blank transformation object.



Project the required ports from the Source Qualifier to the transformation object.
Edit Rank Transformation.


Go to the Ports Tab and apply RANK on Salary Check the R box. Apply Group By on the department no. 


Click on Apply and then OK.

Now in the Properties Tab 

Set Top/Botton to Top and Number of Ranks to 2. 

(It will fetch us the top 2 salaries)

RANK also uses CACHE




Now we have selected department wise top two salaries, but our objective is to fetch the second highest salary so we will apply a fliter with the condition RANKINDEX = 2.

Create a Filter Transformation. Project the required ports from RANK to FILTER.
Edit Filter – In the Properties Tab apply the condition RANKINDEX = 2.
Apply -> OK

Project the required ports from the Filter to the Target.
SQ -> T_RANK -> T_FIL -> DIM_RANK.
(To increase the performance, use SORTER Transformation before T_RANK)


Create a Session
Create a Workflow
Repository _> Save
Start Workflow
 
We encounter an error.




Edit the Session.

In the Mappings Tab, select the target DIM_RANK. In the Properties, Set Target Load Type as Normal.
Repository -> Save

Start the Workflow Again.

Now the load is successful.

Comments

  1. how to remove the duplicate record by using rank transformation

    ReplyDelete

Post a Comment

Popular posts from this blog

Contact Me

Do You have any queries ?                   If you are having any query or wishing to get any type of help related Datawarehouse, OBIEE, OBIA, OAC then please e-email on below. I will reply to your email within 24 hrs. If I didn’t reply to you within 24 Hrs., Please be patience, I must be busy in some work. kashif7222@gmail.com

Top 130 SQL Interview Questions And Answers

1. Display the dept information from department table.   Select   *   from   dept; 2. Display the details of all employees   Select * from emp; 3. Display the name and job for all employees    Select ename ,job from emp; 4. Display name and salary for all employees.   Select ename   , sal   from emp;   5. Display employee number and total salary   for each employee. Select empno, sal+comm from emp; 6. Display employee name and annual salary for all employees.   Select empno,empname,12*sal+nvl(comm,0) annualsal from emp; 7. Display the names of all employees who are working in department number 10   Select ename from emp where deptno=10; 8. Display the names of all employees working as   clerks and drawing a salary more than 3000   Select ename from emp where job=’clerk’and sal>3000; 9. Display employee number and names for employees who earn commissi...

Top 100 Informatica Interview Questions

I have attended Informatica interview last week in wipro and couple of other companies, Question below I faced in those companies. 1. What are the main issues while working with flat files as source and as targets ? 2. Explain about Informatica server process that how it works relates to mapping variables? 3. write a query to retrieve the latest records from the table sorted by version(scd) 4. How do you handle two sessions in Informatica 5. which one is better performance wise joiner or look up 6. How to partition the Session? 7. How many types of sessions are there in informatica.please explain them. 8. Explain the pipeline partition with real time example? 9. Explain about cumulative Sum or moving sum? 10. CONVERT MULTIPLE ROWS TO SINGLE ROW (MULTIPLE COLUMNS) IN INFORMATICA 11. DEPLOYMENT GROUPS IN INFORMATICA 12. LOAD LAST N RECORDS OF FILE INTO TARGET TABLE - INFORMATICA 13. LOAD ALTERNATIVE RECORDS / ROWS INTO...