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: 
YADAVSLN
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
pradosh_thakur
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.
maxgro
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;
jonathandienst
Partner - Champion III
Partner - Champion III

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