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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Separate names

Hi,

I've the follwoing names in a column:

Lastname, firstname and in some cases

lastname, firstnameLastname, firstname,...

The following lastname ist joined to the previous firstname without a symbol. There is only a line break.

e.g.:

Miller, James

Smith, Marc

Flesher, JonasRabo, David

Jaris, Martha

Holder, SvenVeno, SusenStark, JulieZery, Claus

How can I separate the names in the script if there are several in one cell?

Labels (1)
12 Replies
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Have you tried Subfield:

LOAD SubField(Names, ',') as New_names

,*

INLINE [

    Names

    "jim, bill"

    john

];

Screenshot_1.jpg

martinpohl
Partner - Master
Partner - Master

see attached file

Anonymous
Not applicable
Author

File?

martinpohl
Partner - Master
Partner - Master

Unbenannt.JPG

can't you see attach?

Anonymous
Not applicable
Author

The problem is, who to separate the lastname (person 2) form a privious firstname (Person 1).

Flesher, JonasRabo, David

I need:

"Flesher, Jonas" separated from "Rabo, David"

Anonymous
Not applicable
Author

This is what I can see:

jonathandienst
Partner - Champion III
Partner - Champion III

Are you opening this from your inbox? You may need to be in a browser.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

I'm using the Internet Explorer.

martinpohl
Partner - Master
Partner - Master

here is a better script:

Data:

LOAD * INLINE [
    Names
    "Miller, James"
    "Smith, Marc"
    "Flesher, JonasRabo, David"
    "Jaris, Martha"
    "Holder, SvenVeno, SusenStark, JulieZery, Claus"
];

// replace all letters with a pre | (pipe)
Data2:
load
replace(
replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(
Names,'A','|A'),'B','|B'),'C','|C'),'D','|D'),'E','|E'),'F','|F'),'G','|G'),'H','|H'),'I','|I'),'J','|J'),'K','|K'),'L','|L'),'M','|M'),'N','|N'),'O','|O'),'P','|P'),'Q','|Q'),'R','|R'),'S','|S'),'T','|T'),'U','|U'),'V','|V'),'W','|W'),'X','|X'),'Y','|Y'),'Z','|Z')
  ,' |',' ') as Name  // but clean | when space is in front
resident Data;
Data3:
load
SubField(Name,'|') as AllNames  // seperate values between pipes
resident Data2;

Dataclean:
NoConcatenate
load
AllNames
resident
Data3
where len(trim(AllNames)) > 0;  // clean datas

drop table Data3;

Unbenannt.JPG