Domino Code Fragment

Code Name*
Doing a DBLookup using LotusScript
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.222.67.251
Description*
Notes support services has one....it uses a dummy form that has a field
for each of the parameters in a @dblookup...the dblookup field is a computed
field, and you should do the following:
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:

1. create a new document in the database.


2. set the proper field values (ie, doc.field1="servername", doc.field2=
"db name", doc.field3="key", etc..)


3. set the form, (ie, doc.form="form name")


4. call computewithform.


5. extract the value for the computed field (tmp=doc.dblookup)
of course you could simulate a dblookup if you do not want to create a form
that does this--get a handle on the database, then, the view, then in the
documentcollection, scroll through each element, then get the appropriate
handle, then return the value you want back.


-------------------------------------------
Function DbLookup(Server As String, Path As String, View As String, Key As String, ColumnNr As Integer) As Variant

Dim db As NotesDatabase
Dim v As NotesView
Dim d As NotesDocument
Dim rc As Variant
On Error Goto FunctionError

Set db = New NotesDatabase(Server, Path)
Set v = db.Getview(View)
Set d = v.GetDocumentByKey(Key, True)
rc = d.ColumnValues(ColumnNr)
ExitFunction:
DbLookup = rc
Exit Function
FunctionError:
rc = Null
Resume ExitFunction
End Function