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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
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
Partner - Specialist
Partner - Specialist

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
Champion III
Champion III

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;