Hi all!I have two db:
- db contains view with one column.
Column contains sorted, separated data entries (from multivalue field).
Data entries are lower-case
- db contains code
dim person as NotesDocument
…
set person = =viewDB1.GetDocumentByKey(userName.Abbreviated,True)
'and this moment have strange problem person doc is nothing!
'but if i change the code:
set person = =viewDB1.GetDocumentByKey(LCase(userName.Abbreviated),True)
'the person doc is correct (not is nothing)
Why GetDocumentByKey case-sensitive? But domino designer help says: "Matches are not case-sensitive. For example, “Turban” matches “turban.” In an exact match, “cat” matches “cat” but does not match “category,”…
May be cause is in symbol '' of userName.Abbreviated? May be it a lotus bug? i don’t know
Subject: RE: strange behavior GetDocumentByKey
Does the view use case-sensitive sorting?
Subject: RE: strange behavior GetDocumentByKey
view doesn’t use case-sensitive sorting
Subject: RE: strange behavior GetDocumentByKey
Here’s some sample code I tried:
Dim db As New NotesDatabase("", "names.nsf")
Dim vu As NotesView
Dim doc As NotesDocument
Set vu = db.GetView("($VIMPeople)")
Dim uname$
uname = "Sam Spade/SanFran/IBM"
Set doc = vu.GetDocumentByKey(uname, True)
If doc Is Nothing Then
Msgbox "Failed to find '" & uname & "'"
Else
Msgbox "Found '" & uname & "', noteid=" & doc.NoteID
End If
Delete doc
uname = Lcase(uname)
Set doc = vu.GetDocumentByKey(uname, True)
If doc Is Nothing Then
Msgbox "Failed to find '" & uname & "'"
Else
Msgbox "Found '" & uname & "', noteid=" & doc.NoteID
End If
As I expected, this found the document for “Sam Spade/SanFran/IBM” in both cases.
I suggest you put your key into a string variable and use the debugger to confirm what the value is before the lookup. Does it contain any unusual characters?