GetAllDocumentsByKey vs GetAllEntriesbykey

Hi all,

is there suppose to be a difference between GetAlldocumentsByKey and GetAllEntriesByKey ?? i mean internally ??

I know that the second one returns the documents as they appear in the view (sorted)…

i have code that returns a collection with the getalldocumentsbykey method. in my test, i have one document in the collection. i then assign the doc by getting the first document of the collection.

Set collection = MyView.getalldocumentsbykey(“O”)

set doc = collection.getfirstdocument

This gives me a problem at time to time as the getfirstdocument of the collection keeps the old cached value of the doc. in other words, the new changes to the document (these changes are made before the getAllDocumentsByKey call) are not seen when i use a notesdocument collection. This problem is not frequent but is new since a migrated from notes 5 to notes 7.

If i use the GetAllEntriesByKey, then get the firstEntry and the get the doc, the new changes are seen then …

Set vc = myView.GetAllEntriesByKey(“O”)

Set entry = vc.GetFirstEntry

Set doc = myview.getfirstdocument

i don’t think this is normal ???

I just could use, in this case, the GetAllEntriesByKey method, but i am a bit worried that this ‘bug’ would be elsewhere in some of my other applications …

Subject: GetAllDocumentsByKey vs GetAllEntriesbykey

Set vc = myView.GetAllEntriesByKey(“O”)Set entry = vc.GetFirstEntry

Set doc = myview.getfirstdocument ?

Why you are setting the doc from myview if you are using ViewEntryCollection?

ViewEntryCollection, as you said will have the entries that correspond to documents, sorted and do not contain any categories and is faster than documentcollection.

if you want to set document using viewentrycollection, you can do this as:

Set vc = myView.GetAllEntriesByKey(“O”)

Set entry = vc.GetFirstEntry()

Set doc = entry.Document

Subject: RE: GetAllDocumentsByKey vs GetAllEntriesbykey

Thanks for the response

You’re right … but it’s my typo in the post … (pasted the wrong line as i have a lot of code for the tests)

i am getting the doc with the vc

Set vc = myView.GetAllEntriesByKey(“O”)

Set entry = vc.GetFirstEntry

Set doc = Entry.document

so, unfortunately, that’s not it !!!

SNIF SNIF