Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Capitalize issue with names like William III

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

9 Replies
yura_ratu
Partner - Creator II
Partner - Creator II

Hi Max,

Look at this discussion Capitalize function and acronyms

swuehl
MVP
MVP

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)

yura_ratu
Partner - Creator II
Partner - Creator II

In your case I guess the better way is to create a list of non-transforming words and make it mapping load

swuehl
MVP
MVP

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.

Not applicable
Author

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.

swuehl
MVP
MVP

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).

Not applicable
Author

Thanks swuehl,

its working.

sasiparupudi1
Master III
Master III

Hi

Please close this thread by marking the correct answer

Sasi

MarcoWedel

Hi,

another solution could be:

QlikCommunity_Thread_173455_Pic1.JPG

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