Wednesday 28 November 2012

Lookup On Multiple Records In Informatica 9


Informatica 9 Scenario: Need to lookup on File with multiple records and extract records with specific condition (For example in this case only account number starting with “12”)

 Source File
ID
User_Name
1
James
2
Williams
3
Ravi

Lookup file
ID
Account_Name
Account_number
1
Acc _James_1
123232
1
Acc _James_2
45778266
2
Acc _ Williams_1
5455546
2
Acc _ Williams_2
1234343
3
Acc _ Ravi_1
254589
3
Acc _ Ravi_2
12544456

Expected Output
ID
Account_Name
Account_number
User_Name
1
Acc _James_1
123232
James
2
Acc _ Williams_2
1234343
Williams
3
Acc _ Ravi_2
12544456
Ravi

a)In the Lookup condition give the option for Multiple Output for the matching records (this option only available for Informatica 9).The output in Lookup will be as below(Data in Expression)

ID
Account_Name
Account_number
User_Name
1
Acc _James_1
123232
James
1
Acc _James_2
45778266
James
2
Acc _ Williams_1
5455546
Williams
2
Acc _ Williams_2
1234343
Williams
3
Acc _ Ravi_1
254589
Ravi
3
Acc _ Ravi_2
12544456
Ravi

b)In expression check for the account starting with “12” using below condition
IIF (SUBSTR (Account_number, 1, 1) =’12’, 1, 0)
 
c)Next step is quite simple. We can use a filter and take records only were the flag is 1.The output will be as below

ID
Account_Name
Account_number
User_Name
1
Acc _James_1
123232
James
2
Acc_ Williams_2
1234343
Williams
3
Acc _ Ravi_2
12544456
Ravi

3 comments:

  1. A small correction, the substr() length is wrong. it should be 2 not 1.

    wrong: IIF (SUBSTR (Account_number, 1, 1) =’12’, 1, 0)
    correct: IIF (SUBSTR (Account_number, 1, 2) =’12’, 1, 0)

    ReplyDelete
    Replies
    1. Thanks a lot Sketch for your correction..Please keep sharing your ideas on Informatica and Datawarehouse

      Delete
    2. please share the screen shots of lookup transformation Multiple Output for the matching records (this option only available for Informatica 9).

      Delete

Related Posts Plugin for WordPress, Blogger...

ShareThis