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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

help with subfield

Hi all,

I have a field (@8) which contains user logon names, but they are a mixture of formats. i.e.

NT-DOMAIN\FirstnameLastname

NT-DOMAIN\R_FirstnameLastname

I have used the following to strip out the domain and \ so i just end up with the FirstnameLastname

lower(SubField(@8,'\',2)

this works great for the majority of the logon names but it leaves a few that are :

R_FirstnameLastname.

Can anyone tell me how to also strip out the R_ all in the same expression?

note: R_ is only one, there are other letters too with underscores (so not always R)

Thanks

13 Replies
SunilChauhan
Champion II
Champion II

Hi You can try This

=If(findoneof(@8,'_')>0,Subfield(@8,'_',2),Subfield(@8,'\',2))

either in script or in Expression you can use this

see the attched file

hope this helps

Sunil Chauhan
Not applicable

this works.

if(left(@8,12)='NT-DOMAIN\R_',Subfield(@8,'_',2),subfield(@8,'\',2))

maxgro
MVP
MVP

2014-03-12 16_49_08-QlikView x64 - [C__Users_mgrossi_Downloads_parameter.qvw_].png

NT:

load

if(WildMatch(Result, '*_*'), Right(Result, len(Result) - Index(Result, '_')), Result) as Result,

Name;

load

Name,

SubField(Name,'\',2) as Result

;

load * inline [

Name

NT-DOMAIN\FirstnameLastname

NT-DOMAIN\FirstnameLastname2

NT-DOMAIN\FirstnameLastname3

NT-DOMAIN\R_FirstnameLastname4

NT-DOMAIN\R_FirstnameLastname5

NT-DOMAIN\R_FirstnameLastname6

NT-DOMAIN\R_FirstnameLastname7

NT-DOMAIN\RU_FirstnameLastname8

];

MK_QSL
MVP
MVP

SubField(Replace(YourFieldName,'_','\'),'\',-1)