docs.StampAll and radio button

Hello Everyone. I’m using LotusScript to automatically set the “Status” radio button field to ‘Archive’. First, it gets all the documents by Author from the ExpDocs view. Then, it should set the field to ALL docs. The view is categorized by Author first and then by Category. My problem is that not ALL docs are updated, just the first category under each Author. Does anyone have any suggestions on what I could be doing wrong? I included a part of the code below. Thanks for your help in advance.

'Get Authors

While Not entry Is Nothing

 If entry.ColumnValues(0) <>"" Then

If Isarray(authors) Then

	varAuthor = entry.ColumnValues(0)

	authors = Arrayappend(authors, varAuthor)

Else

	strAuthor(0) = entry.ColumnValues(0) 

	authors = strAuthor

End If

 End If

 Set entry = nav.GetNextCategory(entry)

Wend

Forall author In authors

 Set expiredDocs = view.GetAllDocumentsByKey(author)

 Call expiredDocs.StampAll("Status", "Archive")

 Set expiredDoc = expiredDocs.GetFirstDocument

 Call NotifyAuthor(expiredDocs, expiredDoc, view, author)

End Forall

Subject: docs.StampAll and radio button

You’re making this a lot harder than it needs t be with ViewEntries. You’re not setting different categories to different values, are you? If all you need to do is set every document in that view to Status=Archive, then just skip the documentcollection and loop through the view.

Set v = db.getview(“yourView”)

v.AutoUpdate = false

Set doc = v.getfirstdocument

While not doc is nothing

doc.Status = “Archive”

call doc.save(true, true)

Set doc = v.getnextdocument(doc)

Wed

Subject: RE: docs.StampAll and radio button

Esther, thank you for your quick response. The reason why I am (or was) using a Forall loop was because I need to send 1 email to each author with a link to the view. I would rather NOT send an email for each document that was modified. I hope this explains things better.

Subject: RE: docs.StampAll and radio button

I have not used the NotesViewNavigator object, but from your description it sounds like it may treat the entire category string (multiple levels) as the next “category”.

You could split up your processing - build a list of the Authors, stamp all the docs in the view, then generate the emails to the authors.

You could do something like:

’ Get all author names and put in an array

Dim authors as Variant

Dim expiredVC as NotesViewEntryCollection

Dim macro as string

set doc = view.GetFirstDocument

macro = {@Unique(@DbColumn(“”:“NoCache”;“”;“viewname”;1))}

authors = Evaluate(macro, doc)

’ get all view entries and set Status to ‘Archive’

Set expiredVC = view.AllEntries

Call expiredVC.StampAll(“Status”, “Archive”)

’ send email to each author

Forall author In authors

Set expiredDocs = view.GetAllDocumentsByKey(author)

Set expiredDoc = expiredDocs.GetFirstDocument

Call NotifyAuthor(expiredDocs, expiredDoc, view, author)

End Forall

Subject: RE: docs.StampAll and radio button

Thank you, Martha, for your response. I used your suggestion of adding the NotesViewEntryCollection and put the code to set the Status field right above the Forall loop and it worked great! Again, thank you for your help.