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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

First Letter capital in crystal

Status
Not open for further replies.

CrystalUser1

Programmer
Sep 16, 2004
138
US
Hi,

I am using Crystal reports 9.0. There is a field in the database which is string with all uppercase words like "THIS IS A TEST PARAGRAPH". i would like to display this in the report like "This is a test Paragraph". Only first letter should be capitalized.

Is there any formula in crysal 9.0?

thanks in advance.
 
Why is the word 'Paragraph" capitalized in your example?

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
If the field is only one sentence, then you should be able to use:

ucase({table.field[1])+lcase(mid({table.field},2)

If you have multiple sentences in the field, then you could try a formula like the following which capitalizes the first word in each sentence and the word "I". This would have to be expanded to allow for sentences ending in other than a period, and it does not allow for proper nouns in the body of the sentence, i.e., this is a simple version of sentence case:

whileprintingrecords;
stringvar str := "";
numbervar cnt := len({@paragraph});
numbervar i := 0;

for i := 1 to cnt do(
if i = 1 or
(
i > 2 and
{@paragraph}[i-2] = "."
) or
(
i > 1 and
{@paragraph}[i-1 to i+1] = " I "
) then
str := str + ucase({@paragraph}) else
str := str + lcase({@paragraph}));
str

Replace {@paragraph} with your {table.field}.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top