You are on page 1of 4

Posted by nelrick on Dec 31 at 12:17 AM Hi, I need to develop a complex mapping in Informatica.

Here is the scenario: All employees have to undergo certain tasks. Under one task there are multiple activities. We have Activity_Status as 'PASS' or 'FAIL' for each activity. Now if for instance in the example below, if employee with EmpNo=1500 has undergone Activities - ACT_1_FLD_100 and ACT_2_FLD_100, then for that particular Task i.e. FLD_100 I want to populate a column Task_Status = 'COMPLETE' in target table since he has Activity_Status = 'PASS' in both activities for that Task. Similarly if any one Activity_Status = 'FAIL' for a particular Task('FLD_101' in this case), the Task_Status = 'INCOMPLETE' in the target table. Now for EmpNo=1500, He has two tasks (FLD_100 with Task_Status = 'COMPLETE' and FLD_101 with Task_Status = 'INCOMPLETE'), so I want to populate a column 'Emp_Status' for all these records as 'DISQUALIFIED' since he has one Task_Status as 'INCOMPLETE' For another EmpNo=1459, in the O/P desired section, he has Emp_Status='QUALIFIED' because both his Task_Status='COMPLETE' for FLD_105 and FLD_106 The issue also is that there are multiple employees and also the number of tasks and activities are not fixed. So i am looking for a solution that will handle all this dynamically. Was thinking of a solution wherein I parameterize the EmpNo and Task fields and then check on the Activities for that particular EmpNo and Task. I/P EmpNo|Task|Activity|Activity_Status 1500|FLD_100|ACT_1_FLD_100|PASS 1500|FLD_100|ACT_2_FLD_100|PASS 1500|FLD_101|ACT_1_FLD_101|FAIL 1500|FLD_101|ACT_2_FLD_101|PASS 1459|FLD_105|ACT_2_FLD_105|PASS 1459|FLD_105|ACT_3_FLD_105|PASS 1459|FLD_106|ACT_1_FLD_106|PASS O/P desired: EmpNo|Task|Activity|Activity_Status|Task_Status|Emp_Status 1500|FLD_100|ACT_1_FLD_100|PASS|COMPLETE|DISQUALIFIED 1500|FLD_100|ACT_2_FLD_100|PASS|COMPLETE|DISQUALIFIED 1500|FLD_101|ACT_1_FLD_101|FAIL|INCOMPLETE|DISQUALIFIED 1500|FLD_101|ACT_2_FLD_101|PASS|INCOMPLETE|DISQUALIFIED 1459|FLD_105|ACT_2_FLD_105|PASS|COMPLETE|QUALIFIED 1459|FLD_105|ACT_3_FLD_105|PASS|COMPLETE|QUALIFIED 1459|FLD_106|ACT_1_FLD_106|PASS|COMPLETE|QUALIFIED Looking forward to a solution from the Informatica Gurus. Please help its a bit urgent !! Really appreciate the help you have been providing on the blog. Thanks & Regards, Nel

Posted by bhargavi_konathala (Software Engineer) Mark as helpful on Dec 31 at 1:39 AM 1. Use sorter (sort by EMP_ID and ACTVY_STATUS) So, if any activy_status is Fail, that record will come first. 2. Drag all the columns into an expression. Follow the same order of input, variable and ouput ports as mentioned below. a. Uncheck the output port for EMP_ID. a. v_FLAG--> Varible/Char 1 ----> IIF(prev_EMP_ID = EMP_ID, 'N', 'Y')

c. v_EMP_STATUS ----> Varble port/char(15)--->IIF(v_FLAG = 'Y', IIF(ACTVY_STATUS = 'FAIL','DISQUALIFIED','QUALIFIED'),'QUALIFIED') d. prev_EMP_ID ----> variable port ---> EMP_ID (Call EMP_ID) e. o_EMP_STATUS ---> output port----> v_EMP_STATUS (Call variable port) f. o_TASK_STATUS ---> output port ---> IIF(ACTVY_STATUS='PASS','COMPLETE','INCOMPLETE) use all the ports... Hope this will work... Note: in sorter, while sorting, see that FAIL should come first for ACTVY_STATUS for each emp_id....it may be ascend or descend

Posted by nelrick on Dec 31 at 4:21 AM Hi Bhargavi,

Mark as helpful

Thanks for the reply. The Task_Status is coming correctly as desired, but the EMP_STATUS is coming incorrect because when we are evaluating : IIF(v_FLAG = 'Y', IIF(ACTVY_STATUS = 'FAIL','DISQUALIFIED','QUALIFIED'),'QUALIFIED'), we are directly evaluating for v_FLAG='N' as 'QUALIFIED', so for some records the EMP_STATUS='QUALIFIED' even if his TASK_STATUS='INCOMPLETE'. Thanks & Regards, Nel

Posted by bhargavi_konathala (Software Engineer) on Dec 31 at 12:36 PM Hi Nel, I think, we just need to include few more conditions inaddition to the above... c. v_EMP_STATUS ----> Varble port/char(15)--->IIF(v_FLAG = 'Y', IIF(ACTVY_STATUS = 'FAIL','DISQUALIFIED','QUALIFIED'),IIF(prev_EMP_STATUS = 'DIQULAIFIED','DISQUALIFIED','QUALIFIED')) g. prev_EMP_STATUS ----> v_EMP_STATUS (call v_EMP_STATUS) - Bhargavi Konathala

Mark as helpful

Note: ------in sorter, while sorting, see that FAIL should come first in ACTVY_STATUS for each emp_id....it may be ascend or descend ... For ex: 1 PASS 1 PASS 2 FAIL 2 PASS 2 PASS

3 FAIL 3 PASS

Posted by bhargavi_konathala (Software Engineer) Mark as helpful on Dec 31 at 12:55 PM correction: -----c. v_EMP_STATUS ----> Varble port/char(15)--->IIF(v_FLAG = 'Y', IIF(ACTVY_STATUS = 'FAIL','DISQUALIFIED','QUALIFIED'),IIF(prev_EMP_ST ATUS = 'DISQULAIFIED','DISQUALIFIED','QUALIFIED'))

Posted by Ram M Reddy (Informatica) on Jan 1 at 9:54 AM Hi Nel, This can be done with two instance of source( drag same source) in mappings, 1)from 1st instance of source drag all ports to Expression add and o/p port Task_status(O port)--->iif(Activity_Status='PASS','COMPLETE','INCOMPLETE') 2) i) From 2nd instance of source drag only EmpNo,Activity_Status to Sorter transformation and check key EmpNo(ascending) and Activity_Status(ascending) ii)Pass all ports to Aggregator transformation group by EmpNo, add an o/p port Status_out(O port)------>first(Activity_Status) 3)Take Joiner trans and drag ports for Exptrans(1st instance(detail)) and Aggtrans(2nd instance(master)) make JOIN CONDITON as EmpNo=EmpNo1 4)Pass all ports from Joiner Trans (expect empno1) to Exp trans ,add an o/p port Emp_Status(O port)------>iif(Activity_status='PASS' AND Status_out='PASS', 'QUALIFIED','DISQUALIFIED') 5)Drag required ports to target Hope this will work Ram

Mark as helpful

Posted by nelrick on Jan 1 at 10:01 AM Hi Bhargavi,

Mark as helpful

The solution given by you worked fine. Thanks a ton for the prompt reply. I have tested for different possible scenarios and combinations by modifying the soure data, but I still get the desired output. Thanks & Regards, Nelrick

Posted by bhargavi_konathala (Software Engineer) on Jan 1 at 12:08 PM Nice to hear that Nel... - Bhargavi

Mark as helpful

Posted by nelrick on Jan 1 at 1:59 PM Hi, Thanks a lot Ram and Bhargavi, I have implemented both your suggestions in the mapping and have tested and verified it. Keep up the good work. Thanks & Regards, Nelrick.

Mark as helpful

You might also like