Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a list of names to which I am capitalizing. I am using the function QlikView function Capitalize (Names). It is doing fine for names having one word but it also does the capitalization of 2nd part of name as well.
For example the name ( WILLIAM III ) will become ( William Iii ) which looks odd.
I would really appreciate if someone can help me solve this issue since the user wants ( William III )instead of ( William Iii )
Thanks
Hi Max,
Look at this discussion Capitalize function and acronyms
But it should transform MAX NORMAL to Max Normal, right? Or are we sure that the second etc. part should always be upper case?
=Capitalize(Subfield(Names, ' ',1)) & Mid(Names, index(Names, ' ',1)+1)
In your case I guess the better way is to create a list of non-transforming words and make it mapping load
Maybe like this:
ROMANMAP:
MAPPING
LOAD ' '&Capitalize(RomanNumber), ' '&RomanNumber;
LOAD num(recno(),'(ROM)') as RomanNumber
AutoGenerate 1000;
LOAD *, MapSubString('ROMANMAP',Capitalized) as KeepROMANAlive;
LOAD Names, Capitalize(Names) as Capitalized INLINE [
Names
MAX NORMAL
WILLIAM III
INGRID INGMAR XAVER
IXI PIXI
];
For non-transforming roman numbers up to decimal 1000.
Hi swuehl
Thanks for the suggestion of
=Capitalize(Subfield(Names, ' ',1)) & Mid(Names, index(Names, ' ',1)+1)
I will try to explain my problem again. I have First Name and Last Name. I have everything in uppercase.
eg.
FirstName LastName
MAX NORMAL
CHRIS WILLIAM III
All are in upper case. I did Capitalize the First Name and last name, so MAX become Max and NORMAL becomes Normal
Also, CHRIS becomes Chris but WILLIAM III is William Iii. I want to see William III.
@Swuehl : Your solution is working for that particular name i.e. William III but rest of names getting duplicated with Upper and capitalize. eg. NORMAL becomes Normal NORMAL. Thanks again.
I don't see that the names get duplicated (just a spaces is removed, hence updated:
=Capitalize(Subfield(Names, ' ',1)) & Mid(Names, index(Names, ' ',1))
)
But I see your issue that you don't want the last name still in upper case.
Try my second suggestion using a MAPPING solution (you would need to add other literals to the map that you don't want to be transformed, though).
Thanks swuehl,
its working.
Hi
Please close this thread by marking the correct answer
Sasi
Hi,
another solution could be:
LOAD Name,
Concat(If(Num#(SubName,'(ROM)'),SubName,Capitalize(SubName)),' ',SubNamePos) as NameCapitalized
Group By Name, ID;
LOAD RecNo() as ID,
IterNo() as SubNamePos,
Name,
SubField(Name,' ',IterNo()) as SubName
Inline [
Name
William HENRY Gates III
WILLIAM GATES III
John I
JOHN DOE II
John III
JOHN IV Doe
Jane I
JANE Doe II
Jane III
JANE IV
Jane V
JANE VI
Jane Doe VII
Jane VIII
Jane IX
JANE DOE X
Jane XI
Jane XII
Jane DOE XIII
JANE XX
Jane LX
Jane DOE MCMLXXXV
JET LI
]
While IterNo()<=SubStringCount(Name,' ')+1;
(Although JET LI wouldn't pass the 'roman test' . So the Upper(Name)=Name test might be the better choice.)
hope this helps
regards
Marco