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!

String Manpulation

Status
Not open for further replies.

kutoose

Technical User
Sep 11, 2002
169
US
Hi All,
I would like to know how to create a formula which will display a different name format.

In the database, the name is of the format, First Name Middle Initial Last Name

Example

Tracy A Hall

I need to display ( Last Name Comma First Name Middle Initial )

So the above example will be Hall, Tracy A

Please help

kutoose@yahoo.com
 
see thread149-841554 which addresses exactly what you need
 
The larger problem is that your table is very poorly designed, take an acid laced belt sander to the dba until there's only a little toe left, then fire it.

The challenge is that names aren't as simple as your example, for instance:

Oscar De La Hoya

Or in the case of my brother, he doesn't have a middle name.

How would logic determine where to make the break?

One method (depending upon your version of Crystal) is to use:

whileprintingrecords;
stringvar array Name := split({table.field}," ")
//logic to make assumptions
if ubound(Name) = 2 then
Name[2]+", "+Name[1]
else if ubound(Name) = 3 then
Name[3]+", "+Name[1]+" "+Name[2]
else if ubound(Name) = 4 then
// guess at some logic

There are no generic rules, which is why names should ALWAYS be stored in seperate fields.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top