Subject: @dblookup for lotus script?
here is an article that I found some time ago:
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:
-
create a new document in the database.
-
set the proper field values (ie, doc.field1=“servername”, doc.field2=
“db name”, doc.field3=“key”, etc…)
-
set the form, (ie, doc.form=“form name”)
-
call computewithform.
-
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