I it possible to use lotus script to reverse a name? I’m having them pick from a address book and I’d like to have it show LASTNAME FIRSTNAME with no comma.
Thanks in advance.
I it possible to use lotus script to reverse a name? I’m having them pick from a address book and I’d like to have it show LASTNAME FIRSTNAME with no comma.
Thanks in advance.
Subject: Name Question-Yes
Yes you could do it in either script or formula language.
It would be something like this, and keep in mind you may need to deal with a middle name.
Looking for the space
pos = Instr(doc.EmpName(0), " ")
first = Left(doc.EmpName(0), (Len(doc.EmpName(0))-pos))
last = Right(doc.EmpName(0), (Len(doc.EmpName(0))-pos))
Now check for a middle name/initial
pos = Instr(first, " ")
If pos > 0 Then first = Left(first, (pos-1))
pos = Instr(last, " ")
If pos >0 Then last = Right(last, (Len(last)-pos))
Subject: RE: Name Question-Yes
Or, how about
EmpName = Split(doc.EmpName(0)," ")
First = EmpName(0)
Last = EmpName(UBound(EmpName))
Since the last element in the EmpName array contains the last name, we don’t have to worry about a middle name or initial.
Subject: RE: Name Question-Yes
But what about multipart first and last names? How would you handle “Mary Ellen Van Der Welt” using your local rules for names? Note that “Mary Ellen” is considered a single name in many regions (and may be such to the owner even if custom says otherwise), and that the Dutch “van der” prefix has been anglicized so that using lower-case prefix filters or the Dutch regional rules (which ignore prefixes for name lists in order to avoid having, say, a telephone book consisting mostly of vees) do not apply.
Splitting a name reliably is not a trivial exercise. The only proper way to do it is to consult an authority – the NAB for your users, a contact database for customers, and so on.