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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
srujanaponnuru
Creator
Creator

how to separate first name and second name from single column

hi,

i have a list box as shown below:

Hotel Owner
Peter, Goerge
Bradley, cooper
Jim, Watson

I need a output like this as shown below:

PrimarySecondary
PeterGeorge
BradeleyCooper
JimWatson

The first name listed in each cell is the prmary and the second is the secondary.  please suggest.

1 Solution

Accepted Solutions
ThornOfCrowns
Specialist II
Specialist II

The inline load was just to load some example data, it isn't the solution.

View solution in original post

6 Replies
Anil_Babu_Samineni

Like This

Load SubField(HotelOwner,',',1) as Primary, SubField(HotelOwner,',',2) as Secondary

Load * Inline [

HotelOwner

Peter, Goerge

Bradley, Cooper

Jim, Watson

];

Then take only Primary and Secondary to Table box

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
srujanaponnuru
Creator
Creator
Author

i ahve huge data like that..i can t use inline to add all the data.. so is there any pther way to add.

Anil_Babu_Samineni

Like This

Load *,SubField(HotelOwner,',',1) as Primary, SubField(HotelOwner,',',2) as Secondary;


//This is Your Table

Load * FROM <Table>;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anil_Babu_Samineni

OR You can use This

Load *,SubField(HotelOwner,',',1) as Primary, SubField(HotelOwner,',',-1) as Secondary;


//This is Your Table

Load * FROM <Table>;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
its_anandrjs
Champion III
Champion III

Try this way

SourceData:
LOAD * Inline
[
"Hotel Owner"
"Peter, Goerge"
"Bradley, cooper"
"Jim, Watson"
]
;

New:
LOAD
*,
SubField("Hotel Owner",',',1) as Primary,
SubField("Hotel Owner",',',2) as Secondary

Resident SourceData;
DROP Table SourceData;

Regards,

Anand

ThornOfCrowns
Specialist II
Specialist II

The inline load was just to load some example data, it isn't the solution.