Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
You can try:
=mid(SubField(@8,'\',2), index(SubField(@8,'\',2), '_')+1)
Hope this helps!
Hi
Just nest the subfields, like this:
=SubField(SubField(@8,'\',2) '_', 2)
HTH
Jonathan
Hi
why not only
=SubField(@8, '_', 2) which give FirstnameLastname
best regards
Chris
Thanks Jonathan, but that fails to reload. it says its missing a close bracket, although it looks correct to me.
also, i still need to make the field lower case.
try this
if you want to purge certain character then use below
purgechar ( 'NT-DOMAIN\R_FirstnameLastname','R_' ) returns ''NT-DOMAIN\FirstnameLastname'
or
Trim(Replace(Replace(Replace(SubField(@8, '\', 2), 'R_FirstnameLastname', 'FirstnameLastname'))) AS ColumnField
Hi christian,
that would work if all of the logon names were in the format of
NT-DOMAIN\R_FirstnameLastname.
That doesnt work for the ones in the format of
NT-DOMAIN\FirstnameLastname.
Hi Sunil,
Thanks, but as i said not all are in the format of R_, some are C_, A_ etc.
I thought i could wrap another subfield around my current one like Jonathan suggested, but i can't get it to work
try this
if you want to purge certain character then use below
purgechar ( 'NT-DOMAIN\R_FirstnameLastname','R_' ) returns ''NT-DOMAIN\FirstnameLastname'
or
Trim(Replace(Replace(Replace(SubField(@8, '\', 2), 'R_F', 'F'), 'C_F', 'F'), 'A_', 'F')) AS imex
u may continue in these manner
You can try:
=mid(SubField(@8,'\',2), index(SubField(@8,'\',2), '_')+1)
Hope this helps!
Hi,
Try this
=SubField(SubField(@8,'\',2) ,'_', 2)