Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I want to apply a string function to the field [DM Name] to extract initials. For example, if the name is John Smith, I want JS.
I have the following string function but how do I use this to create a new field with initials?
left([DM Name], 1)
&
left(subfield([DM Name], ' ', 2), 1)
Thanks,
Isabel
load
....
,left([DM Name], 1) & left(subfield([DM Name], ' ', 2), 1) as [NewFieldName]
.....
from
Use it in script like:
Table1:
Load
[DM Name],
left([DM Name], 1) & left(subfield([DM Name], ' ', 2), 1) as [DM Name Initial],
....
FROM ....;
Hope this helps!
Hi,
maybe a more generic approach in case there are also middle names:
LOAD [DM Name],
Concat(Left(Names,1),'',RecNo()) as Initials
Group By [DM Name], RecNo;
LOAD [DM Name],
SubField([DM Name], ' ') as Names,
RecNo() as RecNo
Inline [
DM Name
John Smith
Jane Smith
Jane Smith
Bob Smith
John William Smith
Jane Mary Smith
];
hope this helps
regards
Marco