Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I have a variable/column called NAME, where some names start with "Dr ", Mr" etc. and I want to delete this to make "Mr. James" become only "James", for example.
I did this subroutine:
SUB CleanName (SourceString)
IF Left(SourceString,3) = 'Mr '
SourceString = Right(SourceString,Len(SourceString)-3);
IF Left(SourceString,3) = 'Ms '
SourceString = Right(SourceString,Len(SourceString)-3);
IF Left(SourceString,4) = 'Mrs '
SourceString = Right(SourceString,Len(SourceString)-4);
IF Left(SourceString,3) = 'Dr '
SourceString = Right(SourceString,Len(SourceString)-3);
END SUB
And called it by typing
CALL CleanName(NAME);
in the last row of the Main tab, nut it didn't work.
Any friend can point me where is the error or how can I do what I want?
Thanks but didn't work.
Merging some suggestions, I found the solution:
if(match(subfield($1,' ',1),'Mr','Ms','Mrs','Dr'),trim(replace($1,subfield($1,' ',1),' ')),$1)
Thank very much for all!