Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
suhascool1
Contributor III
Contributor III

how to split from one column in to other column

i have one column eg : 

in this column we have hypen (-), Underscore(_), space( ).

Project Number Column
PADJ007809-1235334
PADJ007810_1232341
PADJ007811 1235334

 

and split in to the multiple column as given below

Project Number Job_ID
PADJ007809 1235334
PADJ007810 1232341
PADJ007811 1235334

 

Labels (1)
2 Solutions

Accepted Solutions
theoat
Partner - Creator III
Partner - Creator III

Good morning,

It is possible to resolve this case in the script with the functions "replace" and "subfield".
You can create, since the field "Project Number Column", the fields "Project Number" and "Job_ID" like this :
subfield(replace(replace("Project Number Column",'-',' '),'_',' '),' ',1) as [Project Number],
subfield(replace(replace("Project Number Column",'-',' '),'_',' '),' ',1) as JobID

The pictures can help you.

Kind regards,
Théo ATRAGIE.

View solution in original post

vincent_ardiet_
Specialist
Specialist

Have you always the same kind of pattern?
For example either <projectnumber>_<jobid> ,  <projectnumber> <jobid> or <projectnumber>.<jobid>?
If this is the case, you can use:
Subfield(Replace(Replace([Project Number Column],'.','_'),chr(32),'_'),'_',1) as [Project Number]
,Subfield(Replace(Replace([Project Number Column],'.','_'),chr(32),'_'),'_',2) as [Job_ID]

View solution in original post

7 Replies
theoat
Partner - Creator III
Partner - Creator III

Good morning,

It is possible to resolve this case in the script with the functions "replace" and "subfield".
You can create, since the field "Project Number Column", the fields "Project Number" and "Job_ID" like this :
subfield(replace(replace("Project Number Column",'-',' '),'_',' '),' ',1) as [Project Number],
subfield(replace(replace("Project Number Column",'-',' '),'_',' '),' ',1) as JobID

The pictures can help you.

Kind regards,
Théo ATRAGIE.

vincent_ardiet_
Specialist
Specialist

Have you always the same kind of pattern?
For example either <projectnumber>_<jobid> ,  <projectnumber> <jobid> or <projectnumber>.<jobid>?
If this is the case, you can use:
Subfield(Replace(Replace([Project Number Column],'.','_'),chr(32),'_'),'_',1) as [Project Number]
,Subfield(Replace(Replace([Project Number Column],'.','_'),chr(32),'_'),'_',2) as [Job_ID]

suhascool1
Contributor III
Contributor III
Author

yes

 

Antoine04
Partner - Creator III
Partner - Creator III

You can try to use the function subfield() to split your values !

Anil_Babu_Samineni

@suhascool1 My best approach with, You add as many messy character to Map table.

 

Map:
Mapping load * inline [
Source, Destination
-, %
_, %
];
 
LOAD [Project Number Column],
SubField(Replace(MapSubString('Map', [Project Number Column]), chr(32),'%'), '%', 1) as First,
SubField(Replace(MapSubString('Map', [Project Number Column]), chr(32),'%'), '%', 2) as Second
FROM
(html, utf8, UserAgent is 'Mozilla/5.0', embedded labels, table is @1);
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
suhascool1
Contributor III
Contributor III
Author

Thank you very much 

 

now issue resolved.

 

suhascool1
Contributor III
Contributor III
Author

thank you