Mass .removeitem Efficiency

What is the fastest and most efficient way to remove a specific field from all documents in a database having that field using LotusScript? Not all documents will have this field. The database has ~75k documents and ~20k documents have the field. the ~20k documents are different each day.

Subject: Mass .removeitem Efficiency

dim s as notessessiondim db as ntoesdatabase

dim dc as notesdocumentcollection

dim doc as notesdocument

set s = new notessession

set db = s.currentdatabase

db.delayupdates = true

set dc = db.alldocuments

set doc = dc.getfirstdocument

do while not doc is nothing

if doc.hasitem(“x”) then call doc.getfirstitem(“x”).remove:call doc.save(false,false)

set doc = dc.getnextdocument(doc)

loop

You could also do a dbsearch to identify up front those docs where the item exists. This would take time, but the returned collection would be smaller. The key thing is to delay updates. This script will run a lot faster if the db is local.

Subject: Mass .removeitem Efficiency

Check with Subject line or something of the documents or based on the UNID of the docs create an uniqure number or so and delete the stuff using notesdocument.removeitem

Subject: Mass .removeitem Efficiency

If the item is a numeric or text field, the most efficient way is probably to create a view based on that item, then use the NotesDocumentCollection.StampAll method if you just want to blank them out, or a formula agent such as:

FIELD myField := @DeleteField;

“”

if you need to remove the item entirely.