Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Input has full name field - How to split into FirstName, LastName, etc

My input data has only a FullName field. Is there a tool in to parse the field into separate FirstName, LastName, etc. fields?
The input looks like this: "Firstname Middlename Lastname", where the Middlename can be an initial, a full middle name, a maiden name, or not present. Lastnames can be hyphenated. No prefixes, suffixes, but it would be great to handle those, too.
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Is there a way to use an if statement in the expression field of tMAP? What would the syntax be?
I want to do something like this for the LastName map expression:
if(StringHandling.LEN(row2.LastName)==0) row2.MiddleInitial
else row2.LastName

Yes, you can use the if...else...statement like this:
StringHandling.LEN(row2.LastName)==0?row2.MiddleInitial : row2.LastName
Shong

View solution in original post

10 Replies
janhess
Creator II
Creator II

Just use Java string handling.
Anonymous
Not applicable
Author

Can you make a more specific suggestion?
Thanks.
janhess
Creator II
Creator II

See my entry in this post
https://community.talend.com/t5/Design-and-Development/File-Transfer/td-p/115967
relating to a function for splitting strings.
Anonymous
Not applicable
Author

When I go to that link I get:
Info
Bad request. The link you followed is incorrect or outdated.
Go back
??
janhess
Creator II
Creator II

I've just updated it to a new link.
Anonymous
Not applicable
Author

That example didn't apply directly as my input does not have fixed-length fields.
As the FullName components are delimited with <sp> characters, I'm trying tExtractDelimitedFields with some progress.
This works well when there all three name components exist, but puts the LastName in the MiddleName field where there is no MiddleName. I'm trying to use tMap to move the LastName from the MiddleName field to the LastName field in this situation.
Is there a way to use an if statement in the expression field of tMAP? What would the syntax be?
I want to do something like this for the LastName map expression:
if(StringHandling.LEN(row2.LastName)==0) row2.MiddleInitial
else row2.LastName
and for the MiddleInitial map expression:
if(StringHandling.LEN(row2.LastName)!=0) row2.MiddleInitial
What is the correct syntax for this?
Anonymous
Not applicable
Author

Is there a way to use an if statement in the expression field of tMAP? What would the syntax be?
I want to do something like this for the LastName map expression:
if(StringHandling.LEN(row2.LastName)==0) row2.MiddleInitial
else row2.LastName

Yes, you can use the if...else...statement like this:
StringHandling.LEN(row2.LastName)==0?row2.MiddleInitial : row2.LastName
Shong
janhess
Creator II
Creator II

That example didn't apply directly as my input does not have fixed-length fields.

The code works for variable length text and any delimited text can be extracted.
Anonymous
Not applicable
Author

Thanks shong, your suggestion solved my problem!
Is there any tool or technique that can parse a more complex combined-name field (such as: Mr. John J. Jones Jr.) into fine-grained fields (such as Prefix, FN, MN, LN, Suffix)? I'll probably get sources like this in the future.