The code below has NO output, even though it SHOULD output the name of the found VIP.
Note:
-
It -does- find a match because it does not print “Not found”.
-
There is a field called “Name” in that doc because I checked by hand, twice 
Anyone have any idea what the problem could be?
Code is below.
Dim VSession As New NotesSession
Dim db As NotesDatabase
Dim VIP As NotesDocument
Dim VIPView As NotesView
Set db = VSession.CurrentDatabase
Set VIPView = db.getView(“Existing Customers”)
Set VIP = VIPView.GetDocumentByKey(SSIN)
If ( VIP Is Nothing ) Then
Print "Problem: VIP Not found."
End If
Print “Test=”
Print VIP.GetItemValue(“Name”)
Subject: GetDocumentByKey Code Problem
Have you followed it through in the debugger? You should be able to see exactly what you get for VIPView and VIP.
Subject: RE: GetDocumentByKey Code Problem
I would, but it’s an Agent triggered by a webpage and deals with all sorts of web data.
Subject: GetDocumentByKey Code Problem
Not sure if this will help but…
Where does SSIN get its value?
And the view you’re using has to sorted on the first column. And the first column field should be the value you’re looking for. (You can of course use more than one field to search for, but then the columns would have to be in the order that you expect GetDocumentByKey to find them.
Subject: RE: GetDocumentByKey Code Problem
Sorry about not clarifying SSIN beforehand. SSIN is a variable that gets a value earlier in the code. I have tested it and checked its value against what it should be and it’s correct. Its correctness is also validated by the fact that VIP is not null after the GetDocumentByKey call.
Subject: Try…
v1 = VIP.GetItemValue(“Name”) Print “Test=” + v1(0)
Subject: Hey!
Thanks for the response!
That worked. But why does Lotusscript require such a roundabout way?
Subject: RE: Hey!
Because all fields in Notes are actually arrays. You can skip the extra step by just calling VIP.Name(0)
Subject: RE: Hey!
Now I understand. Thanks all for the help.
Subject: Its not the roundabout way, it is the fact that all items return an array of values.
except for RichText which is a whole nother beast. That is how multivalue items are handled.