Sie sind auf Seite 1von 11

Hi.. I have following scenario to be achieved using informatica.. 1.

First not null ADD1 record for ID from source should go to target table and t he remaining records for same ID should be skipped 2. For ID's having all the ADD1 field as null should go to error table.. Following are the source and target table snapshot...any suggestions please.. Source data ============================= ID SR ADD1 5 5 1 1 1 2 2 2 3 3 3 4 4 4 6 c d a b c a b c a b c a b c d sai3 sai1 sai1 sai3 sai1 sai1 sai2 sai3

Taget Table ============================== ID SR ADD1 5 1 2 3 c a c a sai3 sai1 sai1 sai1

ERROR table =============================== ID SR ADD1 4 a 6 d Thanks.. Reply to this email to post your response. __.____._ Manage Settings | Unsubscribe | Create FAQ | Send Feedback Copyright 2012 Toolbox.com and message author. Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251 sushil Sr. Software Engineer View this online

Ask a new question In the Spotlight Have a Data Warehouse Question? Ask Your Peers at Toolbox for IT _.____.__ vijay-oracle_consultant informatica-l@groups.ittoolbox.com Jul 7 (11 days ago) to me Reply from vijay-oracle_consultant on Jul 7 at 2:17 PM Hi Sushil, Here is the solution. Follow these steps. STEP1: Add one more extra column for source in source analyzer "CNT" with datatype numb er. Override the SQL in source qualifier with the following query. SELECT A.ID, A.SR,A.ADD1, (SELECT COUNT(*) FROM I_TEST1_SRC WHERE ID=A.ID AND ADD1 IS NOT NULL) CNT FROM I_TEST1_SRC A STEP2: Create router transformation, Connect all the output ports of source qualifer to this router. Add two groups in the router. GROUP NAME GROUP FILTER CONDITION GRP_NULL IIF(CNT=0,TRUE,FALSE) GRP_NOTNULL IIF(CNT=0,FALSE,IIF(ISNULL(ADD1)=FALSE,TRUE,FALSE) ) STEP3: Create an expression transformation EXP_NOTNULL. Connect the output ports of Group GRP_NOTNULL from router to expression transfor mation EXP_NOTNULL. Create three more ports in expression EXP_NOTNULL. PORT NAME PORT TYPE EXPRESSION P_ID VARIABLE V_ID V_ID VARIABLE ID I_FLAG OUTPUT IIF(P_ID=V_ID,'N','Y') STEP4: Create filter transformation FLTR_NOTNULL Connect the outputports of EXP_NOTNULL to FLTR_NOTNULL. FLTR_NOTNULL condition: IIF(I_FLAG='Y',TRUE,FALSE) STEP5: Connect the output ports of FLTR_NOTNULL to target table. STEP6: Create an expression transformation EXP_NULL. Connect the output ports of Group GRP_NULL from router to expression transformat ion EXP_NULL. Create three more ports in expression EXP_NULL. PORT NAME PORT TYPE EXPRESSION P_ID VARIABLE V_ID V_ID VARIABLE ID I_FLAG OUTPUT IIF(P_ID=V_ID,'N','Y') STEP7: Create filter transformation FLTR_NULL Connect the outputports of EXP_NULL to FLTR_NULL. FLTR_NULL condition: IIF(I_FLAG='Y',TRUE,FALSE)

STEP8: Connect the output ports of FLTR_NULL to target error table. Let me know the feedback. Thanks, Vijay vijay-oracle_consultant Oracle Consultant 5 achievements Mark as helpful View this online Ask a new question In the Spotlight Earn Recognition for Your Contributions at Toolbox for IT. Gain Points for Commu nity Achievements _.____.__ sakurelalit informatica-l@groups.ittoolbox.com Jul 9 (9 days ago) to me Reply from sakurelalit on Jul 9 at 6:06 AM Hi Sushil, Please try this Source data === ID SR ADD1 5 5 1 1 1 2 2 2 3 3 3 4 4 4 6 c d a b c a b c a b c a b c d sai3 sai1 sai1 sai3 sai1 sai1 sai2 sai3

Steps to Follow : 1. Use sorter Transformation : ( Enable this property to treat null values as lo wer than any other value when it performs the sort operation ) Sotert Transformation : 1 a sai1

1 1 2 2 2 3 3 3 4 4 5 5 6

c b c a b a b c a b c d d

sai3 sai1 sai1 sai2 sai3 sai3 sai1

2. Aggrgator Transformation ( Group by on column ID and use first function to re trive first row of group ) 1 2 3 5 4 6 a c a c a d sai1 sai1 sai1 sai3

3. Router Transformation : ( Two groups first for ADD1 not null and second for A DD is NULL ) First Group : 1 2 3 5 a c a c sai1 sai1 sai1 sai3

Second Group : 4 a 6 d I hope this will work !!! Please let me know if it works. Thanks, Lalit sakurelalit 1 achievement Mark as helpful View this online Ask a new question In the Spotlight Earn Recognition for Your Contributions at Toolbox for IT. Gain Points for Commu

nity Achievements _.____.__ satyaveenator informatica-l@groups.ittoolbox.com Jul 9 (9 days ago) to me Reply from satyaveenator on Jul 9 at 12:31 PM Lalit, your solution is much simpler , however, the first function on the ID col umn retrieves the second 5 d sai1 , not 5 c sai3 I added the first function on the ID column in the aggregator Group by was on ID and SR ascending this is the output I got 1 2 3 5 ,c ,c ,c ,d ,sai3 ,sai1 ,sai3 ,sai1 satyaveenator 2 achievements Mark as helpful View this online Ask a new question In the Spotlight Have a Data Warehouse Question? Ask Your Peers at Toolbox for IT _.____.__ sakurelalit informatica-l@groups.ittoolbox.com Jul 10 (8 days ago) to me Reply from sakurelalit on Jul 10 at 5:53 AM Hi satya, I too having the same output :(, Aggregator is picking the last row . Have you tried this with some different approach? Thank, Lalit sakurelalit 1 achievement Mark as helpful View this online Ask a new question In the Spotlight Earn Recognition for Your Contributions at Toolbox for IT. Gain Points for Commu nity Achievements

_.____.__ shrushtiammulya informatica-l@groups.ittoolbox.com Jul 11 (7 days ago) to me Reply from shrushtiammulya on Jul 10 at 10:26 PM Hi, Solution for your scenario: For first occurrence of ID having ADD1 not null source-->sourcequalifier--->expression1 expression1 ports ? ID SR ADD1 v_c_id---ID v_flag --- IIF(NOT(IS_NULL(ADD1)),1,0) o_flag--- v_flag v_i_count --- DECODE(TRUE,v_c_id=v_p_id,v_i_count+1,v_c_id!=v_p_ id,1) o_i_count --- v_i_count v_p_id---v_c_id v_fnn_count--- IIF(v_c_id=v_p_id,(IIF(v_flag=1,v_fnn_count+1,v_fn n_count)) o_fnn_count---v_fnn_count ? pass it to another expression2 transformation ID SR ADD1 v_c_id---ID o_fnn_count o_i_count o_flag v_fnnx_count--- DECODE(TRUE,o_flag=0,v_c_id=v_p_id,v_fnnx_count+1, ???????????????????????????????????????????????????????o_flag=1,0, ?????????????????????????????????????????????????????? o_flag=0,v_c_id!=v_p_id,1 ) o_fnnx_count --- v_fnnx_count v_p_id---v_c_id ? now pass from expression one to another expression3 ?and another to filter trans formation ie old expression---new expression3(here u will get IDs where ADD1 is null for all SR)?and old expression---filter transformation(here u will get first occurrence of ID ha ving ADD1 nonnull values) ? ? FILTER condition: o_flag=1 AND o_fnn_count=0 ? new expression3: ID SR ADD1 o_fnnx_count ? from here pass it to aggregator: ID???????????? group by ID

SR ADD1 o_fnnx_count lasts_fnnx_count---LAST(o_fnnx_count) c_id---COUNT(ID) ? then pass it to another filter transformation condition: last_fnnx_count=c_id ? then pass it to second target ? source---sourcequalifier---expression1---expression2---filter and expression3 ???? filter---target1 expression3---aggregator---filter---target2 -----------------Original Message--------------From: satyaveenator Sent: Monday, July 09, 2012 12:32 PM Subject: Loading Null and Not Null Values Using Informatica Lalit, your solution is much simpler , however, the first function on the ID col umn retrieves the second 5 d sai1 , not 5 c sai3 I added the first function on the ID column in the aggregator Group by was on ID and SR ascending this is the output I got 1 2 3 5 ,c ,c ,c ,d ,sai3 ,sai1 ,sai3 ,sai1

Reply to this email to post your response. __.____._ Manage Settings | Unsubscribe | Create FAQ | Send Feedback Copyright 2012 Toolbox.com and message author. Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251 shrushtiammulya Mark as helpful View this online Ask a new question In the Spotlight Earn Recognition for Your Contributions at Toolbox for IT. Gain Points for Commu nity Achievements _.____.__ Community_Member informatica-l@groups.ittoolbox.com

8:30 PM (16 hours ago) to me Reply from shrushti on Jul 17 at 11:00 AM Hi Solution for your scenario. For first occurrence of id having ADD1 not null source-->sourcequalifier---->expression expression ports ID SR ADD1 v_c_id------ID v_flag ----- IIF(NOT(IS_NULL(ADD1)),1,0) o_flag----- v_flag v_i_count ------ DECODE(TRUE,v_c_id=v_p_id,v_i_count+1,v_c_id!=v_p_ id,1) o_i_count ---------- v_i_count v_p_id------v_c_id v_fnn_count----------- IIF(v_c_id=v_p_id,(IIF(v_flag=1,v_fnn_count+1,v_fn n_coun t)) o_fnn_count-----------v_fnn_count pass it to another expression transformation ID SR ADD1 v_c_id----ID o_fnn_count o_i_count o_flag v_fnnx_count----------- DECODE(TRUE,o_flag=0,v_c_id=v_p_id,v_fnnx_count+1, o_flag=1,0, o_flag=0,v_c_id!=v_p_id,1)

o_fnnx_count ---------- v_fnnx_count v_p_id-----v_c_id now pass from expression one to another expression and another to filter transfo rmation ie old expression-----new expression(here u will get IDs where ADD1 is null for all SR) and old expression----filter transformation(here u will get first occurrence of ID h aving ADD1 nonnull values) FILTER condition: o_flag=1 AND o_fnn_count=0 new expression: ID SR ADD1 o_fnnx_count from here pass it to aggregator: ID group by ID SR ADD1 o_fnnx_count lasts_fnnx_count-------------LAST(o_fnnx_count) c_id------COUNT(ID) then pass it to another filter transformation condition: last_fnnx_count=c_id then pass it to target. source---sourcequalifier---expression1----expression2-----filter and expression3 filter----target1 expression3-----aggregator---filter---target2 ---------------Original Message--------------From: Sushil Ramteke

Sent: Friday, July 06, 2012 6:18 PM Subject: Loading Null and Not Null Values Using Informatica

Reply to this email to post your response. __.____._ Manage Settings | Unsubscribe | Create FAQ | Send Feedback Copyright 2012 Toolbox.com and message author. Toolbox.com 4343 N. Scottsdale Road Suite 280, Scottsdale, AZ 85251 shrushti Mark as helpful View this online Ask a new question In the Spotlight Become a blogger at Toolbox.com and share your expertise with the community. Sta rt today. _.____.__ Community_Member informatica-l@groups.ittoolbox.com 8:32 PM (16 hours ago) to me Reply from shrushti on Jul 17 at 11:01 AM Hi, Logic is. First find first occurrence of notnull ADD1 values v_flag--------NOT(IS_NULL(ADD1)) then give count for nonnull ADD1 column based on ID.if ADD1 column is null,zero is passed so that we will be checking only nonnull ADD1 values. v_fnn_count------IIF(v_c_id=v_p_id,(IIF(v_flag=1,v_fnn_count+1,v_fn n_count)) v_c_id=id v_p_id=v_c_id then pass it to filter.give condition. o_flag=1 AND o_fnn_count=0 then pass to one target. For IDs who is having null values for all ADD1 columns.here we are only checking for null values of ADD1 column. We will make nonnull ADD1 column equal to zero. v_fnnx_count------DECODE(TRUE,o_flag=0,v_c_id=v_p_id,v_fnnx_count+1, o_flag=1,0, o_flag=0,v_c_id!=v_p_id,1) Then pass to aggregator to do groupby ID column. lasts_fnnx_count---------LAST(o_fnnx_count) counts_id---------COUNT(ID) group by ID pass to filter.give condition.

lasts_fnnx_count=counts_id then pass to another target.

Das könnte Ihnen auch gefallen