@dblookup for lotus script?

Hi,

I have an agent written in Lotus Script, which contains a nested loop, accessing two views (by doc.getfirstitem(…)). I was wondering if there is another way I could lookup the document from lotus script in a view? I heard about view navigators, but couldnt find any example to see if thats what I need. Suggestions?

Thanks.

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:

  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…)

  1. set the form, (ie, doc.form=“form name”)

  2. call computewithform.

  3. 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

Subject: @dblookup for lotus script?

Simply use the Evaluate statement.Then you can use @Dblookup as normal:

For example:

Values1=Evaluate(|“All”:@DbLookup(“Notes”:“NoCache” ; “”; “Keywords”; “Status”; 2)|)

That produces a list with the word all, and then the result of the lookup.

Sometimes it’s handy to include doc at the end…

Values1=Evaluate(|“All”:@DbLookup(“Notes”:“NoCache” ; “”; “Keywords”; “Status”; 2),doc|)