extract fullname to firstname and middlename and lastname

Seven Stars

extract fullname to firstname and middlename and lastname

Hi 

I have an input like below

Input File Data

Smith,john

James,Jones K

Joseph J Walker

 

Need Expected Output like below split FullName column to 3 different Columns

FirstNameMiddleNameLastName
John Smith
JamesKJones
JosephJWalker

kindly help on this i tried using textractregexfield component but not able to get expected output

 

Regards,

Meena


Accepted Solutions
Forteen Stars TRF
Forteen Stars

Re: extract fullname to firstname and middlename and lastname

You just have to check the last part length to decide if you have to get the middle or the last part to populate the lastname:

Capture.png

Here is the result:

[statistics] connecting to socket on port 3468
[statistics] connected
.---------------+------+------+------.
|             tLogRow_1              |
|=--------------+------+------+-----=|
|fullname       |first |middle|last  |
|=--------------+------+------+-----=|
|Smith,john     |Smith |john  |null  |
|James,Jones K  |James |K     |Jones |
|Joseph J Walker|Joseph|J     |Walker|
'---------------+------+------+------'

[statistics] disconnected

Thank's to mark you case as solved (Kudos also accepted as a bonus).


TRF

All Replies
Forteen Stars TRF
Forteen Stars

Re: extract fullname to firstname and middlename and lastname

Based on this answer I have proposed to someone else, you should be able to do what you want.

Start by replacing comma by space using the following expression row1.input.replaceAll(",", " ") then follow this explication https://community.talend.com/t5/Design-and-Development/String-Handling-in-Tmap/m-p/141342#M87305

 


TRF
Seven Stars

Re: extract fullname to firstname and middlename and lastname

@TRF,

 

But I am getting the output like below which is not expected

tLogRow_2 |
|=-------------=|
|FullName |
|=-------------=|
|smith john |
|taylor mary A |
|jhonson david |
|joseph j walker|
'---------------'

.---------+----------+--------.
| tLogRow_3 |
|=--------+----------+-------=|
|FirstName|MiddleName|LastName|
|=--------+----------+-------=|
|taylor |mary |A |
|joseph |j |walker |

Forteen Stars TRF
Forteen Stars

Re: extract fullname to firstname and middlename and lastname

@muralam share your tMap


TRF
Seven Stars

Re: extract fullname to firstname and middlename and lastname

1.JPG2.JPG3.JPG4.JPG

kindly help attached is the job i tried to get output as expected but i am not able to figure where the issue is exactly

Forteen Stars TRF
Forteen Stars

Re: extract fullname to firstname and middlename and lastname

Try the with the proposed solution


TRF
Seven Stars

Re: extract fullname to firstname and middlename and lastname

@TRF,

Thanks for the response, i got the expected result of course not completely

from the screen shot attached i have to handle

if LastName length =1(means LastName is single letter) assign LastName to MiddleName and MiddleName to LastName, could you please help with this issue am i missing something

FirstName|MiddleName|LastName|
|smith | |john |
|taylor |mary |A |
|jhonson | |david |
|joseph |j |walker |
Expected Result is like below

FirstName|MiddleName|LastName|
|smith | |john |
|taylor |A|mary|
|jhonson | |david |
|joseph |j |walker |

kindly suggest

 

Regards,

Meena

 

Forteen Stars TRF
Forteen Stars

Re: extract fullname to firstname and middlename and lastname

You just have to check the last part length to decide if you have to get the middle or the last part to populate the lastname:

Capture.png

Here is the result:

[statistics] connecting to socket on port 3468
[statistics] connected
.---------------+------+------+------.
|             tLogRow_1              |
|=--------------+------+------+-----=|
|fullname       |first |middle|last  |
|=--------------+------+------+-----=|
|Smith,john     |Smith |john  |null  |
|James,Jones K  |James |K     |Jones |
|Joseph J Walker|Joseph|J     |Walker|
'---------------+------+------+------'

[statistics] disconnected

Thank's to mark you case as solved (Kudos also accepted as a bonus).


TRF
Highlighted
Forteen Stars TRF
Forteen Stars

Re: extract fullname to firstname and middlename and lastname

@muralam, thank's to mark your cas as solved


TRF

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.