Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal 8.5 - Capitalizing first letters 1

Status
Not open for further replies.

rayna

Programmer
Sep 24, 2001
54
0
0
CA
I cannot for the life of me locate a way to make, say, "beverly hills" into "Beverly Hills", in 8.5. I tried titlecase() and even leadingcaps() (after finding references to it on the Crystal website) but all I can manage to make work for me is uppercase() and lowercase().

Am I missing something here?

Please help! Thanks!
Rayna

Man plans. God laughs.
 
Dear Rayna,

This should work.

stringvar array m := split({Table.Field});
numbervar i;
stringvar mystr := '';

for i := 1 to ubound(m)
do
Mystr := Mystr + ' ' +uppercase(m[1]) + mid(m,2,255) + '';
MyStr

Notice that I set mystr to initialize as a blank. That works to reset the variable on each row in the detail, if you need it to reset on something other than each row then you would remove the initialization so that mystr is not initialized and create a separate formula to reset the variable and place it where the reset is desired.

Hope that helps,

ro

Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
Rosemary,

Thank you SO much....that worked like a charm!!!

Rayna

Man plans. God laughs.
 
Dear Rayna,

Be aware that in CR 8.5 if the total string length is greater than 254 characters it will fail as the result of a formula cannot be more than 254 characters. You could add error trapping to the end.

I wrote this in a hurry and the formula could be slightly simplified in this line:

Mystr := Mystr + ' ' +uppercase(m[1]) + mid(m,2,255) + '';

you don't need to set the ,255 it can more simply be written as:

Mystr := Mystr + ' ' +uppercase(m[1]) + mid(m,2) + '';

So glad that helped,

regards,
ro


Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
*LOL*

Funny you should mention that! It did fail, and I was too embarassed to ask as I figured I had made an error.

So I merely took the 255 you gave me and made it 254, but since you have offered me up a better solution, I shall take it! :-D

Man plans. God laughs.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top