2nd Post - Lookup using LotusScript in Web Agent

Hello Forum, hope someone can help me with this one.

I have created a agent to do a lookup from the web but I can not get a handle on the values -

Could someone assit me in this agent.

Sub Initialize

Dim session As NotesSession

Set session = New NotesSession

Dim ldb As NotesDatabase 'Lookup up database

Dim view As NotesView ’

Dim doc As NotesDocument

Dim ldoc As NotesDocument

Dim key As String

Set doc = session.DocumentContext

’ Print session.UserName & “

Set ldb = New NotesDatabase(“ServerName”,“admin\myscan.nsf”)

Print " ldb is working
"

Set view = ldb.GetView(“(uname)”)

Print “lview is working

Set ldoc = lview.getDocumentbykey(“Troin Artis”)

If Not ldoc Is Nothing Then

Print “I got a handle on the doc

'Print "Ldoc.databasefilepath
" & ldoc.databasefilepath

Print "ldoc.GetItemValue(DatabaseFilepath)
" & ldoc.GetItemValue(“DatabaseFilepath”)

Print "Ldoc.databasefilepath(0)
" & ldoc.databasefilepath(0)

Print

Else

Print “Can not get a handle on ldoc

End If

%REM

%END REM

End Sub

Subject: 2nd Post - Lookup using LotusScript in Web Agent

I aplogize for reposting - I just figured if I had reposted I would get a response that ask me question about my code instead of how I am running the code. In any event thanks I found the answer.

My code had a typo.

Subject: RE: 2nd Post - Lookup using LotusScript in Web Agent

One of the most important questions to ask about code being run for a web application is how it is being run/called…I was not looking for a typo.

If you had run it through the debugger before posting here, you would have found the typo

Subject: 2nd Post - Lookup using LotusScript in Web Agent

I assume your problem is getting GetDocumentByKey to work? Make sure that “Troin Artis” appears in the first column of the (uname) view, and that the column is sorted. It won’t work if the column is displaying hierarchical names–you must use the Common Username.

I’ve always had trouble getting this method right, so I tend to use db.Search to create a “collection” of one document and work with that.

Note, however, that it’s not certain that your lookup datase and lookup view are being accessed successfully. Your agent is going to print “ldb is working” and “lview is working” whether those lines of code worked or not. These would be better tests:

Print ldb.Title " is assigned to ldb
"

Print lview.Name " is assigned to lview
."

Subject: 2nd Post - Lookup using LotusScript in Web Agent

What’s actually happening? Or not? And why are you re-posting this when you have a thread on the go further down?