Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

String function in Script

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

3 Replies
giakoum
Partner - Master II
Partner - Master II

load

....

,left([DM Name], 1) & left(subfield([DM Name], ' ', 2), 1) as [NewFieldName]

.....

from

jerem1234
Specialist II
Specialist II

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!

MarcoWedel

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

];

QlikCommunity_Thread_129543_Pic1.png

hope this helps

regards

Marco