Tip

Get Lotus Notes Name

Get the exact matching Lotus Notes name or all the similar sounding Lotus Notes
names for the given FirstName and the LastName in a specific server/address
book.
This function can be used as folllowing :

ser$ = "DominoChennai" ' server
addb$ = "Mynames.nsf" ' Address Book name
nflag = 0 ' Flag for names
FN$ = "Gopala" ' First name
LN$ = "Krishnan" ' Last name

fnames$ = GetLNName(LN$,FN$,nflag,ser$,addb$ )

If (nflag = 1 ) Then ' Exact match found
f2 = Evaluate(|@Explode("|+ fnames$ +|";",~")|)
doc.FirstName= f2(0) + " " + f2(1)
doc.LastName= f2(2)
doc.LNname= f2(3)' setting the exact matched name
ElseIf (nflag = 0) Then ' no match found
doc.frname = Trim(fnames$)' setting the deault name itself
doc.FirstName = Trim(t3)
doc.LastName = Trim(t2)
Else
' Found Similar Sounding words
' Gett all the name list in "Allnames"

f1$ = |@Explode("|+AllNames$+|";";")|
Allnames = Evaluate(f1$)

Forall itm In Allnames
' Extract the LotusNotes name from very names
LNNme = Evaluate(|@Subset(@Explode("|+itm+|";"~");-1)| )
Print "Lotus notes Names : " + LNNme(0)
End Forall

End If



-------------------------------------


Function GetLNName(lastname As String , firstname As String , flag As Integer
,NServer As String , NAddBook As String) As String

' This function will return Notes Name if Lastname and first name is passes
as Argument is a Exact Match and will set flag = 1 (success)
' If the function is not able to find Lotus Notes Name
' it will find the the similar Sounding names and will return a string of the
type
' fName, mName , lName ~ FullName ; fName, mName , lName ~ FullName ;
fName, mName , lName ~ FullName ;... and will
' set the flag = Negetive <n> where n is the Number of similar sounding names
that are returned
' If it is not able to find one such name then the Output will be firstname,
lastname and set the flag = 0
' If null server is set it will take the current local server and if null
address book name is passes it will take as names.nsf

Dim session As New Notessession
Dim ws As New NotesUiWorkspace
Dim view As Notesview
Dim doc As NotesDocument
Dim doccol As NotesDocumentCollection
Dim t1 As String, t2 As String
Dim db As New NotesDatabase("","")
Dim Found As Variant
Dim Serv As String
Dim Soundname As String
Dim snxC As Integer

' Setting the server and address book

If (Trim(NServer) = "" ) Then
serv = Cstr(session.Currentdatabase.server)
Else
serv = NServer
End If

If (Trim(NAddBook) = "") Then
NAddBook = "names.nsf"
End If

If ( Not db.Open( serv, NAddBook) ) Then
Msgbox "Address Book not found in the Server",16,"Error"
flag = 0
GetLNName = Trim (lastname + ", " + firstname)
Exit Function
End If

' getting the view from address book
Set view = db.getview("($VIMPeopleBYLastName)")
Set doccol = view.GetAllDocumentsByKey(Trim(lastname),False)

If (doccol.count < 1 ) Then
Print "Lotus Notes Name Not found for the Person " + Trim (lastname
+ ", " + firstname)
flag = 0
GetLNName = Trim (firstname + ", " + lastname )
Exit Function
End If

Found = False
t1$ = ""
t2$ = ""
SoundName$ = ""
snxC = 0

Set doc = doccol.getfirstdocument
While ( Not Doc Is Nothing) And Not Found
t1$ = Trim(doc.FirstName(0))
t2$ = Trim(doc.MiddleInitial(0))
chkvar$ = t1$ + " " + t2$
If ( Lcase(Trim(chkVar$)) = Lcase(Trim(firstname)) And
Lcase(Trim(doc.Lastname(0))) = Lcase(Trim(Lastname))) Then
Found = True ' exact match
Print "Found Lotus Notes name for the Person " + doc.Fullname(0)
GetLNName = doc.Fullname(0)

This was first published in November 2000

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.