DBlookup in Lotusscript

Greetings,I am trying to code a agent script that goes through a set of documents in a view, looks at a approver field on the document, then tries to lookup that data in another database view to return the lookup value but i keep getting a

“Variant does not contain a container”

for example the value i am looking up is

“CN=Ron Graham/OU=AU/O=Heatcraft” stored in field Approvers

the code is

Sub Initialize

Dim session As New NotesSession

Dim view As NotesView

Dim currdoc As NotesDocument

Dim nextdoc As notesdocument

Dim doc As notesdocument

Dim approvername As String

Set db = session.currentdatabase

Set view = db.getview(“viewofdocumentstocheck”

Set currdoc = view.GetFirstDocument

While Not(currdoc Is Nothing)

approvername = currdoc.Approvers(0)

Msgbox "the approver for this document is - "& approvername

eval = Evaluate ({@DbLookup(“”:“NoCache”;“CA257170:0008A76F”;“vw-ALLemployeeNameCheck”; approvername;2)},doc)

Msgbox eval(0)

Set nextdoc = view.GetNextDocument(currdoc)

Set currdoc = nextdoc

Set nextdoc = Nothing

Wend

Exit Sub

The first messagebox command returns the correct value, ie

CN=Ron Graham/OU=AU/O=Heatcraft from the document

yet the lookup is not returning the lookup value as i get the variant does not contain a container error.

The lookup view does have CN=Ron Graham/OU=AU/O=Heatcraft in it.

I noticed however if i change the eval line to have the keyword specifically it does return the lookup value

eval = Evaluate ({@DbLookup(“”:“NoCache”;“DATABASEID”;“lookupviewname”; “CN=Ron Graham/OU=AU/O=Heatcraft”;2)},doc)

Any ideas on how i can get this to work as it cycles through the documents?

Subject: DBlookup in Lotusscript

Hi,we have another option “view.GetAllDocumentsByKey” in LS which provides the same functionality of “@DBLookup” in Formulae language. You can use the abouve (LS) one to get documents based on a key. For this ,Initially we need to open the “Server” & “Database” where we need to get the documents.You ahve already a key “Approver Name”. Refer to designer help.

Thanks,

Guru.

Subject: DBlookup in Lotusscript

Subject: DBlookup in Lotusscript

eval = Evaluate ({@DbLookup(“”:“NoCache”;“CA257170:0008A76F”;“vw-ALLemployeeNameCheck”; approvername;2)}, currdoc)

Konrad

Subject: RE: DBlookup in Lotusscript

sound of hand slapping forehead - thanks heaps

thanks everybody - i ended up redoing it with a getalldocumentsbykey as Guru T suggested

(well i did after a little more head scratching :slight_smile:

and its working fine - but thanks for that.

If any you guys down in Sydney Australia, i owe you a beer…or two…or three… hehe

Subject: DBlookup in Lotusscript

hey your evalate{dblookup--------) formula…u have passed doc as last parameter…but nowhere you are setting that document, i mean u are not getting handle of the doc…this is what i found in you code…plz check…

Regards,

Venkat