Sunday, 1 March 2015

Scenario 26: How to create and use Active Lookup Transformation?

Scenario 26: How to create and use Active Lookup Transformation?

What is Active Lookup Transformation?
When lookup transformation return all the matching records from the Lookup table then it's called as an Active transformation.
This feature of Lookup has been introduced from 9.X version of Informatica Power Center tool.

Business Requirement: We have two table Product and currency now in the target table we have to populate all products with price after taking the all currency rate from currency table.

Note: There is no common column in both tables.

Source.


Source: Two tables

Product Table
Prod_ID
Prod_Name
Price_USD
2001
Laptop
300
2002
Desktop
200
2003
Mouse
20

 Currency Table
ID
Description
Rate
1
SGR
55
2
INR
62
3
EURO
42

Target Table: 
Prod_ID
Prod_Name
Price_USD
Price_SGR
Price_INR
Price_EURO
2001
Laptop
300
16500
18600
12600
2002
Desktop
200
11000
12400
8400
2003
Mouse
20
1100
1240
840
 
Let's Chat: I know! I know you will be saying hey we can achieve this though joiner transformation easily though we don't have column in both tables. A BIG THANK YOU... You have visited my previous posts and learned it well how to handle.
We all know there will be several way to accomplish business requirement. :-) Here I am opting Active Lookup approach to explain the use. Here we go....

Practically

Step 1: Import Product table. (Import your target table as well.)

Step 2: Expression.
 Create one output port. (This port will be used in condition tab of Lookup)
 SRC_DUMMY_ID (Output Port) = 1

Step 3: Lookup 
a) Create Lookup transformation.... Wait. while creating don't forget to check the option which is shown in Picture below.



b) Add a port manually
   DUMMY_ID (Decimal) Output & Lookup port should be checked.

c) Set condition Tab.

DUMMY_ID = SRC_DUMMY_ID

d) Override the SQL in properties tab.

SELECT CURRENCY.DESCRIPTION as DESCRIPTION, CURRENCY.RATE as RATE, 1 as DUMMY_ID, CURRENCY.ID as ID FROM CURRENCY

Step 4: Aggregator
Connect DESCRPTION, RATE and DUMMY_ID to Aggregator
(All port should be checked as GROUP port)

Step 5: Joiner
a) Create Joiner and Selected Sorted Input in Properties tab.
b) Now Drop all ports from Aggregator and Expression (Step2)
c) Select  Ports from Lookup as Master Port in Port Tab.
d) Condition
DUMMY_ID=SRC_DUMMY_ID

Step 6: Expression
Take Prod_ID, Prod_Name, Price, Description, Rate Port from Joiner.
Create three output port for calculating price.
INR_PRICE (Output Port)=IIF(DESCRIPTION='INR', USD_PRICE*RATE)
SGR_PRICE (Output Port)=IIF(DESCRIPTION='SGR', USD_PRICE*RATE)
EURO_PRICE (Output Port)= IIF(DESCRIPTION='EURO', USD_PRICE*RATE)

Step 7: Aggregator
Connect all ports from expression.
Select PROD_ID port as GROUP port.
Create three output port to de-normalize the data.
O_INR_PRICE (Output Port)=MAX(INR_PRICE)
O_SGR_PRICE (Output Port)=MAX(SGR_PRICE)
O_EURO_PRICE (Output Port)= MAX(EURO_PRICE)

Step 8: Connect to your target.

BINGO!!!



Feel free to post your doubt in comment section or though contact form which you can find below the page.

Due to limitation, I can't attach exported .xml file which you can Import in your repository and see or analyse. (Feel free to mail me if you need .xml file with Scenario number and Question.)

If you like the approach and solution feel free to share with others.

Thanks.
hpandey.harsh@gmail.com

27 comments:

  1. Can you explain ,without joining how did you add all the Ports to lookup ?

    ReplyDelete
    Replies
    1. Hi Soumya,

      I didn't add all ports to lookup. I have added only port. Look for STEP 1 (B).

      Instead of reading please implement it practically following steps. Your doubt will be clear.

      Thanks

      Delete
  2. your information is really awesome as well as it is very excellent and i got more interesting information from your blog. iOS App Development Company in India

    ReplyDelete
  3. This was so useful and informative. The article helped me to learn something new. Security alarm in Chennai

    ReplyDelete
  4. Expected and valid points are included in you blog.. I really liked and I got some clear ideas for improve my thoughts from well defined content... keep updating more for us... thanks for shared useful blog..
    SAT Training Centre in Chennai

    ReplyDelete
  5. It’s really amazing that we can record what our visitors do on our site. Thanks for sharing this awesome guide. I’m happy that I came across with your site this article is on point,thanks again and have a great day. Keep update more information..
    Home Interiors in Chennai

    ReplyDelete
  6. Hey ,

    we can make use of unconnected lookup and achieve this solution instead of using Joiner,aggregator and Active lookup at all.


    1) Take product table as source.
    2) Create an unconnected lookup on currency table with join condition on Currency desc and rate as return value.
    3) From exp, call

    :LKP.LKP_curr('SGR') * 300
    :LKP.LKP_curr('INR') * 300
    :LKP.LKP_curr('EURO') * 300

    ReplyDelete
  7. Just great learning from you!

    ReplyDelete
  8. Just read your website. Good one. I liked it. Keep going. you are a best writer your site is very useful and informative

    thanks for sharing!
    android development company in Chennai

    ReplyDelete
  9. I appreciate your efforts because it conveys the message of what you are trying to say. It's a great skill to make even the person who doesn't know about the subject could able to understand the subject . Your blogs are understandable and also elaborately described. I hope to read more and more interesting articles from your blog. All the best.
    Psoriasis Treatment

    ReplyDelete
  10. I simply couldn’t depart your site before suggesting that I really enjoyed the usual information an individual supply in your visitors? Is going to be again steadily to check out new posts.
    Logistic ERP
    Transport ERP
    Manufacturing ERP
    ERP software companies
    Best ERP software
    ERP for the manufacturing industry

    ReplyDelete
  11. It has been just unfathomably liberal with you to give straightforwardly what precisely numerous people would've promoted for an eBook to wind up making some money for their end, basically given that you could have attempted it in the occasion you needed.

    Hadoop Training in Chennai

    ReplyDelete
  12. I read that Post and got it fine and informative. Please share more like that...
    Trading erp software in chennai

    ReplyDelete
  13. Thanks for the informative article. This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.
    Data Science Training in Chennai
    Data science training in bangalore
    Data science online training
    Data science training in pune
    Data science training in kalyan nagar
    selenium training in chennai

    ReplyDelete
  14. Its really an Excellent post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog. Thanks for sharing....
    python training in pune
    python online training
    python training in OMR

    ReplyDelete
  15. I am sure this post has helped me save many hours of browsing other related posts just to find what I was looking for. Many thanks!
    Blueprism training in marathahalli

    Blueprism training in btm

    Blueprism online training

    ReplyDelete
  16. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.


    Amazon Web Services Training in Velachery, Chennai |AWS Training in Velachery , Besant Technologies

    Amazon Web Services Training in Chennai | AWS Training in Chennai

    Amazon Web Services Training in Chennai |Best AWS Training in Chennai

    Amazon Web Services Training in Chennai | AWS Training in OMR,Chennai

    ReplyDelete
  17. Its really an Excellent post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog. Thanks for sharing....

    devops online training

    aws online training

    data science with python online training

    data science online training

    rpa online training

    ReplyDelete
  18. Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information..
    Microsoft Azure online training
    Selenium online training
    Java online training
    Python online training
    uipath online training

    ReplyDelete
  19. I need to thank you for the endeavors you have carefully recorded this site. I'm expecting to see a similar high-grade blog entries from you later on too. Truth be told, your experimental writing capacities has roused me to get my own, own blog now ;) best interiors

    ReplyDelete
  20. They're produced by the very best degree developers who will be distinguished for your polo dress creation. You'll find Ron Lauren inside an exclusive array which includes particular classes for men, women.
    data scientist training in hyderabad

    ReplyDelete