Split name field

krazykasper

Registered User.
Local time
Today, 11:22
Joined
Feb 6, 2007
Messages
35
I'm trying to split a name field in my ODBC table into first name last name and change the case to "proper". The table field {OptimizeIt.OrderRepName} is one field formatted as lastname, mi, firstname
I started using the following code which gives me the last name but not sure where to go from here. Appreciate any help you can provide.

local StringVar Array Names1:=
Split({OptimizeIt.OrderRepName}, " ")[-1];
ProperCase(Names1[Ubound(Names1)]);

Thanks,

Krazy (Bill) Kasper
 
UPDATE - Split name field

Here's the latest...

The structure is lastname, firstname, middleintital.
There is not always a middleinitial.
The code I'm using (follows) only gives me the middleinitial:

local StringVar Array Names1:=
Split({OptimizeIt.OrderRepName}, " ");
If UBound(Names1)=3 Then ProperCase(Names1[3]) Else " "


Changing it to the following only gives me the firstname:

local StringVar Array Names1:=
Split({OptimizeIt.OrderRepName}, " ");
If UBound(Names1)=2 Then ProperCase(Names1[2]) Else " "

Changing it to the following gives me nothing:
(You'd think it would give me the lastname):

local StringVar Array Names1:=
Split({OptimizeIt.OrderRepName}, " ");
If UBound(Names1)=1 Then ProperCase(Names1[1]) Else " "

Can someone help me put this all together so I get firstname middleinitial lastname?
Thanks.

Krazy (Bill) Kasper
 

Users who are viewing this thread

Back
Top Bottom