I have a flat file, in which i have two fields, emp_id,
emp_name. The data is like this,
emp_id,emp_name
101,soha
101,ali
101,khan
102,siva
102,shanker
102,reddy.
how to merge the names so that my output is like this
Emp_id Emp_name
101 Soha ali kahn
102 siva shenkar reddy

please provide solution

Answers were Sorted based on User's Feedback



I have a flat file, in which i have two fields, emp_id, emp_name. The data is like this, emp_id,..

Answer / gd

Use aggregator t/r In that condition group by on emp_id and
create output port with expression concat('emp_id','
','emp_name');

Is This Answer Correct ?    5 Yes 0 No

I have a flat file, in which i have two fields, emp_id, emp_name. The data is like this, emp_id,..

Answer / dharmendra

SOURCE->SRT->EXP->AGT->TGT

SRT - Sort by column col1.
EXP - empid
name
v_name=iif(v_empid=empid,v_name||','||name,name)
v_empid=empid
o_empid=v_empid
o_name=v_name
After this we can use aggregator t/r to take last row for a
particualr emp id using LAST.

Is This Answer Correct ?    4 Yes 0 No

I have a flat file, in which i have two fields, emp_id, emp_name. The data is like this, emp_id,..

Answer / nanda

In expression transformation take a variable port, lets say
v_emp_id and equate it to emp_id,

take one more variable port for calculation as v_cal
and write a expression in v_cal as

v_cal= iff(emp_id=v_emp_id, emp_name||v_cal, emp_name)-----
----- (1)

take an output port O_emp_name and
O_emp_name = v_cal

write the following as shown in the expression
transformation, i meant the order of ports and their
corresponding values

emp_id
emp_name
v_cal the (1) expression
v_emp_id emp_id
O_emp_name v_cal


send the output ports to aggregator and in aggregator
take a output port O_agg_emp_name

emp_id
emp_name
O_emp_name
O_agg_emp_name = last(O_emp_name)

send the emp_id and the O_agg_emp_name to the target
and thts it

Is This Answer Correct ?    2 Yes 0 No

I have a flat file, in which i have two fields, emp_id, emp_name. The data is like this, emp_id,..

Answer / rana

In Expression transformation create four variable port like:
v_ID
v_Fname
v_Mname
v_Lname
and use following condition
v_nr=iif(v_id <> emp_ID,0,v_nr+1)
v_fname=iif(v_nr = 0,emp_name,v_fname)
v_mname=iif(v_nr = 1,emp_name,v_mname)
v_lname=iif(v_nr = 2,emp_name,v_lname)
v_id=iif(v_id <> emp_ID,emp_id,v_id)


Add a Filter transformation, and condition will be (NOT
ISNULL(v_Fname) and NOT ISNULL(v_Mname) and NOT ISNULL
(v_Lname))
Take an example, If rows are like these:
101,soha
101,ali
101,khan
102,siva
102,shanker
102,reddy

For : 101,soha ==>
*v_nr=iif(v_id <> 101,0,v_nr+1) [v_id is now 0 or
null]
It will return 0
*v_fname=iif(v_nr = 0,emp_name,v_fname) [v_nr is 0 now
so "SOHA" will insert into f_name variable]

other condition will be false
-------------------------------
For : 101,ali ==>
*v_nr=iif(101 <> 101,0,v_nr+1) [v_nr is now 1 ]
It will return 1, because condition will FALSE and v_nr+1
will add 1 to 0, mean 1

*v_fname=iif(v_nr = 0,emp_name,v_fname) [v_nr is 1 so
condition is FALSE and it will return v_fname that
is "SOHA" that was stored when v_nr was 0]

*v_mname=iif(v_nr = 1,emp_name,v_mname) [v_nr is 1 and
Condition is TRUE so now it will return emp_name and that
is "ALI"]

other condition will be false
---------------------------------
For : 101,khan ==>
*v_nr=iif(101 <> 101,0,v_nr+1) [v_nr is now 2]
It will return 2, because condition will FALSE and v_nr+1
will add 1 to 1, mean 2

*v_fname=iif(v_nr = 0,emp_name,v_fname) [v_nr is 2 so
condition is FALSE and it will return v_fname that
is "SOHA" that was stored when v_nr was 0]

*v_mname=iif(v_nr = 1,emp_name,v_mname) [v_nr is 2 and
Condition is FALSE and it will return v_mname that is "ALI"
that was stored when v_nr was 1]

*v_lname=iif(v_nr = 2,emp_name,v_lname) [v_nr is 2 now so
condition is TRUE and it will return emp_name and that
is “KHAN” now]


v_id=iif(v_id <> emp_ID,emp_id,v_id)

Let me know if you have still any confusion on this,

Rana

Is This Answer Correct ?    4 Yes 4 No

I have a flat file, in which i have two fields, emp_id, emp_name. The data is like this, emp_id,..

Answer / shirish

In expression transformation use an output port ...in
expression window write emp_id||empname

Is This Answer Correct ?    7 Yes 15 No

Post New Answer

More Informatica Interview Questions

What are the issues you have faced in your project? How did you overcome those issues?

0 Answers   CTS, FEEE, TCS,


Hi experts ,I have a Source of 1000 records.I have to load 100 records in first target,101 to 200 records in 2nd target, 201 to 300 records in 3rd target and again 301 to 400 in first target like that as cyclick process. How can i acheive this.

5 Answers   DELL, TCS,


I have source data like this col1 col2 col3 5 3 8 6 2 9 7 1 10 and i want to get target as col1 col2 col3 5 1 8 6 2 9 7 3 10 which transformation i have to use and how?

3 Answers  


what is mystery dimension?

1 Answers  


What is polling?

1 Answers  






when load type is selected as bulk or normal in session level ?let me know the internal process and give me an example?

3 Answers  


how to through logic of informatica using the push down optimization into oracle.

2 Answers   Hexaware,


1.why we need to use unconnected transformation? 2.where we can static chach,dynamic chach

4 Answers   Virtusa,


How to create or import flat file definition in to the warehouse designer?

0 Answers   Informatica,


I Have 100 Records in a relational tble and i want to load the record in 3 targets , first records goes to target 1 and second to target 2 and third to target 3 and so on ,what are the tx used in this and what are the logics ,can any one help me ?? Thanks in Advance

6 Answers   IBM, TCS,


Explain about the concept of mapping parameters and variables ?

3 Answers   HCL, TCS,


Which kind of index is preferred in DWH?

3 Answers  


Categories