Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the best practices to extract data from flat file source which are bigger than 100 mb memory?

2296


How can we use mapping variables in informatica?

1004


can we override a native sql query within informatica? Where do we do it? How do we do it?

1014


The question was on time stamp. what is the difference between HH and HH24 when to use when.

1996


What is flashback table ? Advance thanks

1873


What are the different ways to implement parallel processing in informatica?

1342


Can we use the mapping parameters or variables created in one mapping into any other reusable transformation?

1219


Suppose on 1st Nov 2010 you had created a mapping which includes huge aggregator calculations and it is under process for next two days. You will notice that even on 3rd day also its still calculating. So without changing a logic or changing a mapping How will you troubleshot or to run that mapping? Explain the steps

1988


What is a sequence generator transformation?

954


-Which expression we can not use in Maplets?, -Can we join(relate) two dimensions in a schema? -Why and where we use 'sorted input' option?

5688


Clarify the utilization of aggregator cache record?

945


Briefly define a session task?

1057


Quickly characterize reusable change?

1061


What is parallel processing in informatica?

1621


Explain the pipeline partition with real time example?

1085