Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Reordering a string in load

Hi all,

I have some data that's ordered: "lastname * firstname * age".

id like to load the column so it just displays "firstname lastname".

Is this possible? Thanks!

5 Replies
Not applicable
Author

load subfield(<column>,'*',2) & ' ' &  subfield(<column>,"*',1) as newname

richard_pearce6
Luminary Alumni
Luminary Alumni

You can do that using string functions

left('[Name]',index('[Name]','*',2)-1) as Name

This reads up to the second space and drops the age

You can put the whole thing into a replace function if you want to drop the middle ' * '

Richard

jsingh71
Partner - Specialist
Partner - Specialist

Use this:

 

SubField('lastname * firstname * age' ,'*',2)  & SubField('lastname * firstname * age' ,'*',1) as Name

--Jai

its_anandrjs

Load new field in the load script

Load

Name,

Right(Trim(Left(Name,index(Name,'*',2)-1)),9)&' '&Trim(Left(Name,index(Name,'*',1)-1)) as NewName

From Location;

preminqlik
Specialist II
Specialist II

Load *,

subfield(fieldname,'*',-2)&' '&subfield(fieldname,'*',-3)               as               Name

from path;