Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
See why BI users voted Qlik #1 in 11 categories. GET REPORT
cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor II
Contributor II

substring within string.

HI All,

I Have a scenario like this:

Example

Name 

Team Member (10000)

Team leader (20000)

Ass Manager (40000)

Manager (60000)

Consultant   (120000)

Associate  Consultant (1300000)

Senior Consultant  (60080)

I want Out put like this;

Name                                         Code

Team Member                    (10000)

Team leader                         (20000)

Ass Manager                        (40000)

Manager                               (60000)

Consultant                        (120000)

Associate  Consultant   (1300000)

Senior Consultant           (60080)

 

Could you please suggest me.Thanks in Adv.

Regards,

YADAVSLN.

3 Replies
Highlighted
Master II
Master II

load Left(Name,Index(Name,'(')-1) as Name,mid(Name,Index(Name,'(')) as Code Inline [
Name 

Team Member (10000)

Team leader (20000)

Ass Manager (40000)

Manager (60000)

Consultant   (120000)

Associate  Consultant (1300000)

Senior Consultant  (60080)

];
Learning never stops.
Highlighted
MVP
MVP

Another solution: if you only have one '(' for row, you can use the subfield funtion

Names: 
Load * inline [
Name
Team Member (10000)
Team leader (20000)
Ass Manager (40000)
Manager (60000)
Consultant   (120000)
Associate  Consultant (1300000)
Senior Consultant  (60080)
];

[2Cols]:
Load
	subfield(Name,'(', 1) as Name,
	'(' & subfield(Name,'(', 2) as Code
Resident Names;

DROP Table Names;
Highlighted

Did you know that you can subfield from the RHS of the string as well? 

Table:
LOAD trim(left(Name, len(code))) as Name, Code;
LOAD Name, SubField(Name, ' ', -1) as Code
Inline
[
	Name
	...
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein