Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Separating two words

Is there a way in QlikView to separate two words at the transformation step into two different words as is the case in MS SQL Server.

For example if I have a name Chris Chitemerere, i can separate this into two new derived columns namely, First Name (Chris) and Second Name (Chitemerere).

Is this possible in QV?

Regards.

Chris

1 Solution

Accepted Solutions
sunny_talwar

I guess the only way I can think of is to use SubField function

SubField(FieldName, ' ', 1) as [First Name],

SubField(FieldName, ' ', 2) as [Last Name],

View solution in original post

7 Replies
sunny_talwar

I guess the only way I can think of is to use SubField function

SubField(FieldName, ' ', 1) as [First Name],

SubField(FieldName, ' ', 2) as [Last Name],

swuehl
MVP
MVP

Maybe like

LOAD

     Subfield(FULLNAME, ' ',1) as FirstName,

     Subfield(FULLNAME, ' ',2) as LastName,

...

or using other string functions, there are a bunch of functions in QV.

Anonymous
Not applicable
Author

THANKS Sunny

Anonymous
Not applicable
Author

Thanks Swuehl

Anonymous
Not applicable
Author

Hi Sunny

What if i have Chris Moore Chitemerere and i want 'Chris More' as FirstandSecondName?

Regards

swuehl
MVP
MVP

This script assumes that your first names and last name are separated by spaces, and last name is only consisting of one word:

LOAD *,

Left(FULL, Index(FULL,' ',-1)-1) as FirstSecond,

Subfield(FULL, ' ',-1) as Last;

LOAD * INLINE [

FULL

Chris Moore Chitemerere

Chris Chitemerere

];

Anonymous
Not applicable
Author

Thanks Swuehl