GetDocumentByKey with 2+ key values doesn't work

For the life of me I can’t get this method to work.

Dim key(0 To 1) As Variant

key(0) = “somestring”

key(1) = s.UserName

Set Doc = View.GetDocumentByKey(key(0), False) '==> Works but only One key value, I have two

Set Doc = View.GetDocumentByKey(key, False) '==> False,True no matter No doc returned

I Dim the array

Dim (0 to 1) as String

Dim (1 to 2) as String

Dim (X to y) as Variant, etc, etc,

Tried:

key(0) works

key having two values doesn’t

(key) no go

I think I have hit every permutation`

Any answers out there?

Subject: GetDocumentByKey with 2+ key values doesn’t work

getDocumentByKey looks after the first sorted column. You should put the two column together in one, and search for this combined column.

Donald DuckDisneyland

When a text i combined like this in a view column it works as one key

Good Luck

ZoomTek.dk

http://www.zoomtek.dk/gb.html

Subject: GOT IT – Mia Culpa

Note to self:
“Make sure the values going into the key array, are indeed the same values in
the view columns being looked at.”

In this case session.Username != session.EffectiveUsername.
And that was the problem. Here’s what help says:

keyArray
String (variable-length only), integer, long, single or double value, or
[array of string], number, DateTime, or DateRange objects. Each
element
in the array is compared to a sorted column in the view. The [first
element
in the array is compared to the first sorted column in the view; the second
element is compared to the second sorted column; and so on
]

Lesson to self:
RTFQuestion and RTFInstruction and RTFDocumentation. It seems complacency has
crept in after years of being a Lotii (plural of Lotus), though my defense if I
needed one would be “How many of us Loti are truely shocked when Notes doesn’t
work as described?”

In this case though, mia culpa.

Thanks for the replies. Here’s the code snippet that works:

Set session = New notessession
Set View = session.GetView(“some_view_name”)
Set effectiveUsername = New NotesName(s.EffectiveUserName)
Dim keys( 1 To 2 ) As String
keys(1) = paramlist(“ParentUNID”)&paramlist(“track”)
keys(2) = effectiveUsername.Common
Set keyDoc = View.GetDocumentByKey( keys )

If keyDoc Is Nothing Then
Set keyDoc = session.CurrentDatabase.CreateDocument
End If

And to the FCC and those ‘citizens’ cheering them on, see what President
Truman has to say:

[

“Those who want the
Government
to regulate matters of the mind and spirit are like men who are so afraid of
being murdered that they commit suicide to avoid assassination.”
Harry S. Truman, Address at the National Arcives, Washington D.C., 15 Dec. 1952, in Public Papers of the Presidents: Harry S. Truman, 1952-53, at 1977, 1079 (1966)
]

Subject: It seems all Notes searching APIs use the first column only

I tried NAMELookup, NAMELookup2, and DBLookup against a view. No matter what name I give to the first column, all searching APIs use the first column only as the key column to match value(s) provided. Am I right for the statement? Thanks.