Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Abbrevation for Name

Hello Qlikers,

I am having a list of Name say:

NAME

Balraj Ahlawat

Sunny T

Jagan Mohan

M G

Now I want one more field which should give me Capital Alphabhats from that list, like

NAME                          Abbrev

Balraj Ahlawat                  BA

Sunny T                          ST

Jagan Mohan                    JM

M G                                MG

From my point fo view I thought of Loop inside Loop, i.e

For i=1 to NoOfRows(Table)

let Vlength=len(Name(i));

For j=1 to $(Vlength)


What should be my condition now to fetch capital alphabats only??


next j

Next i;

Or is their any other alternate or simple way for same?

Regards,

Balraj Ahlawat

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

I thought you just want first character of each word.  If you just want Capital letters then best thing is use Keep() like below

KeepChar(FieldName, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')

View solution in original post

9 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this using SubField() and Concat().

Data:

LOAD

NAME,

Concat(Temp) AS Abbrev

GROUP BY NAME;

LOAD

NAME,

Left(SubField(NAME, ' '), 1) AS Temp

INLINE [

NAME

Balraj Ahlawat

Sunny T

Jagan Mohan];

Regards,

Jagan.

jonathandienst
Partner - Champion III
Partner - Champion III

You could use KeepChar('ABCDEFGHIJKLMNOPQRSTUVWXYZ') to keep only the capitals

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Jagan,

what If I am having name like?

Balraj AhlaWAt

SuNNy T

JaGan MoHan

In this case subject of this thread will not match

But what I am looking for, If I get any upper alphabat in string it should display those alphabats.

Anonymous
Not applicable
Author

Yes, I already did & was working well. But looking for more alternates

jagan
Luminary Alumni
Luminary Alumni

I thought you just want first character of each word.  If you just want Capital letters then best thing is use Keep() like below

KeepChar(FieldName, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')

Anonymous
Not applicable
Author

Okay, Is this the only way to achieve same?

flipside
Partner - Specialist II
Partner - Specialist II

... and just wrap Capitalize in this expression around FieldName if just the 1st char of each word is needed (in caps).

jagan
Luminary Alumni
Luminary Alumni

There are ways but it is the easiest and simpler one.  Otherwise you need to use Nested loops and compare, its a tedious process.

Regards,

Jagan.

Not applicable
Author

Hi balraj,

try like this

load *, left((SubField(NAME,' ',1)),1)&''&left((SubField(NAME,' ',2)),1) as term

INLINE [

NAME

BalRaJ Ahlawat

Sunny T

Jagan Mohan

];

may be helpful for you