Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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')
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.
You could use KeepChar('ABCDEFGHIJKLMNOPQRSTUVWXYZ') to keep only the capitals
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.
Yes, I already did & was working well. But looking for more alternates
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')
Okay, Is this the only way to achieve same?
... and just wrap Capitalize in this expression around FieldName if just the 1st char of each word is needed (in caps).
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.
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