Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
If you are a Qlik Insight Bot user, join this collaborative group: JOIN GROUP
Highlighted
New Contributor III

Change field from "lastname, firstname" to "firstname lastname"

Hi,

I am new to Qlik and trying to change the format of a field. Any help is greatly appreciated as I learn the Qlik expressions.

I have a field that contains names like:               Smith, Ted

I would like to change that field so it reads:        Ted Smith

What is the best expression to use?

Thanks for the help!

Tags (1)
4 Replies
Highlighted
Valued Contributor III

Re: Change field from "lastname, firstname" to "firstname lastname"

trim(subfield(yourfield,',',2))&' '&subfield(yourfield,',',1) as yournewfield

Re: Change field from "lastname, firstname" to "firstname lastname"

Capitalize(subfield(trim(Name),',',2)) &' '& Capitalize(subfield(trim(Name),',',1))  as New_Name

Highlighted
Contributor

Re: Change field from "lastname, firstname" to "firstname lastname"

Check this

LOAD Name,
Capitalize(Name) as Name1,
SubField(Capitalize(Name), ',' , 2)& ' ' & SubField(Capitalize(Name), ',' , 1) as Name2
FROM
[..\Book1_try.xlsx]
(
ooxml, embedded labels, table is Sheet3);

Capitalize will convert the string to First letter as Caps, rest Small

Sub Field to pick up string at position 1, and 2

Please refer to the attached document for string fucntions

Highlighted

Re: Change field from "lastname, firstname" to "firstname lastname"

Three helpful for you, Would you close this thread

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)