Delete object

Hi all,

i’ve been reading posts on this forum (and the whole web) for the past 2 weeks about this delete thing …a lot of these posts come from Andre Guirard… so if you’re reading, please help !!!

This Sounds new to me as i have been developping notes apps for the past 15 years and had never heard of it.

Since we’ve migrated to notes 7 (from 5) we have been getting strange behavior on different apps.

this is an extract from the code that brings me the weirdest problem

Set collectionExpDB2 = MyView.getalldocumentsbykey(“O”)

Set doc = collectionExpDB2.getfirstdocument

While Not (doc Is Nothing)

Print doc.form(0)

Delete doc

Set doc = collectionExpDB2.getfirstdocument

Print doc.form(0)

…

The first print gives me ‘a’

the second print gives me ‘b’

is there a ‘caching’ property that is new … we just migrated from notes 5 to 7 ???

Subject: delete object

Are you saying that the script worked differently with the version 5 client?

Looking in the help, it looks like the Delete statement has been around a long time. In fact it refers specifically to Notes 4 which was when LotusScript was first introduced into Notes.

I haven’t actually used it before but what you are getting might be right if the Destructure subroutine in the NotesDocument class removes the document.

If you don’t want to remove the document, then set the object to Nothing instead.

Subject: RE: delete object

Hi robin,

yes, the script in notes 5 did not have the line :

delete doc

i had no problems then. Now, since version 7, the line:

set doc = collection.getfirstdocument

gets the old cached value of the doc unless i use the delete doc statement …

Also :

I just made more tests and it seems that the getallentriesbykey works better than the getalldocumentsbykey …

Set vc = myView.GetAllEntriesByKey(“O”)

Set entry = vc.GetFirstEntry

Set doc = Entry.document

print doc.form(0)

versus

set coll = myview.getAlldocumentsbykey(“O”)

set doc = coll.getfirstdocument

print doc.form(0)

they do not print the same thing !!! the collection seems to be caching the doc value …