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

Formula to show Full name 1

Status
Not open for further replies.

welshone

Programmer
Jul 30, 2001
414
GB
Hello,
How can I create a formula, to show my forename and surname field with First letter of forename and surname to be capital and the other letters to be lower case ?


eg.

Jo Bloggs

thanks in advance.
 
Quick question... How are the two fields stored currently?
 
Hi,

without downloading the function from the support website, you could use...

uppercase(left({forename},1)+lowercase(mid({forename},2)+
uppercase(left({surname},1)+lowercase(mid({surname},2))

Be aware that this will not cater for null values,
and may become incorrect for double barreled names
eg. Ann-Marie Street Porter --> Ann-marie Street porter
Ronald McDonald --> Ronald Mcdonald


Hth,
Geoff
 
There is another function available (its name escapes me) that is the same as the VB proper function, which capitalizes the first letter of every work in a string. Same downsides as FoxG mentioned with certain names. Software Support for Sage Mas90, Macola, Crystal Reports, Goldmine and MS Office
 
If they are two seperate fields then follow this.

1) Create a formula Field called called CapSurCase (or what ever if best for you.)
2) type this in the formula

UCase(Left({SurName},1))&Lcase(Right({SurName},len({SurName})-1) )

where SurName is the name of your datafield

3) add CapSurCase to your report
 
Blimey,
loads of ways to do it.
cheers guys.
 
I know this question has been answered, but here is yet another way:

numbervar first := Length(trim({table.firstname}));
numbervar last := Length(trim({table.lastname}));
upper({table.firstname}[1])&{table.firstname}[2 to first]&
" "&Upper({table.lastname}[1])&{table.lastname}[2 to last]

This shows the use of the nifty substring operator.


Howard Hammerman,

Crystal Reports training, consulting, books, training material, software, and support. Scheduled training in 8 cities.
howard@hammerman.com
800-783-2269
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top