Searching documents in a categorized view

Hi,

I’m using a view which is categorized by date. Date is the first column and sorted.

The next column is a number, which sorted, too.

Following code generate a runtime error “too many keys”.

I do have two columns, which are sorted (date, which is also categorized and number)

dim keys(1 to 2)as variant

'ddat is NotesDateTime

keys(1) = ddat.DateOnly

'doesn’t work either:keys(1) = ddat

keys(2) = s_number

set doc = sview.GetDocumentByKey(keys)

Can sbdy please help ?

Thanks and regards,

Bernd

Subject: Searching documents in a categorized view

DateOnly property return a String that is not match with your sorted date column.

You must use cdat() to convert the string to be date:

keys(1) = cdat(ddat.DateOnly)

Subject: Or even easier keys(0) = ddat.LSLocalTime

Subject: Searching documents in a categorized view

I would try using a zero based array.

For example

Dim keys(1) as variant

keys(0) = Cdat( ddat.DateOnly)

keys(1) = s_number

Subject: RE: Searching documents in a categorized view

Hi,

thanks for your response !

Unfortunately this doesn’t work:

Dim keys(1) As Variant

keys(0) = Cdat(ddat.DateOnly)

Messagebox keys(0)

keys(1) = s_artnr

Same errormessage.

Greetings Bernd

Subject: RE: Searching documents in a categorized view

In your call to GetDocumentByKey add the True parameter - exact match

i.e.

set doc = sview.GetDocumentByKey(keys, True)

Subject: RE: Searching documents in a categorized view

Hi again,

I’ve done this, but doesn’t work :frowning:

Thanks and regards,

Bernd

Subject: Searching documents in a categorized view

I had a similar problem with “Too many keys”. When I used a copy of the view there was no problem. I fixed the original view by running Fixup (in the Domino Administrator) on the database.

Subject: Possible reason

“Too many keys” may occure if you make the sorted column sortable (Click on column header to sort) notice the sortable arrow.

When you lookup while someone click on sortable column to sort, Lotus Notes will raise this error message.

To prevent this error message you may use hidden view for lookup purpose.