Removing response documents from folder causes error

We have a situation where there are currently 13 databases, one for a specific project and all inheriting from the same template. The prediction is that a new database (with the same template) will have to be created every week for some time. This is not a suitable solution and instead we want one database where all projects can fit in.

The people working with a specific database still need to feel that they are working the same way seing only the documents for a particular project.

The database has a frameset with an outline displaying 23 views which are opened in the right frame.

One solution would be to, for each existing and each new project (former db), create 23 new outline entries and 23 new views. Since we don’t know how many projects the new db will contain this is not a good solution looking at performace and usability.

Another solution is to use an environment variable to set which project a specific person is working on. Depending on the choice, a fixed amount of outline entries would display computed content in a fixed amount of views or folders, based on the environment variable.

Using this approach and views; it is possible to (in queryopen of a view), when clicking an outline entry for the view, perform an FTSearch (for example FIELD field_name = field_value) to find and display the documents for a specific project. However the resultset is not categorized and it has to be, so this is not an option.

Using this approach and folders; In queryopen of a folder, delete any existing content in the folder using “RemoveAllFromFolder” (from previous runs), perform a lookup to a view (getDocumentsByKey on the environment variable value) and put the result (notesdocumentcollection) into the folder.

This last solution works great BUT only when there are no response documents. When clicking on a folder that has response documents, a message box displays saying:

“Notes error: All related response documents are being removed from this folder along with their parents. (FolderName)”. Also when refreshing the folder afterwards, all documents disappears. This error is due to the “RemoveAllFromFolder”.

If I uncheck the folderoption “Show response documents in a hierarchy” the problem is gone. However this is not an option either.

Now I wonder:

#1 Does anyone know a solution or workaround to this folder approach? I can’t seem to catch the error (I think it is 4005) and do a Resume Next or similar because it is not treated as an error. A messagebox appears and the folder is not rendered as it should.

#2 Does anyone have a suggestion to another solution? One I’m thinking of is to go through each document, get its response documents (if any) and remove them first before removing the parent. And thus not run the method “RemoveAllFromFolder”.

Best regards / Niklas

Below is the QueryOpen sub of one of the folders:

Sub Queryopen(Source As Notesuiview, Continue As Variant)

Dim s As New NotesSession

Dim db As NotesDatabase	

Dim folder As NotesView	

Dim view As NotesView

Dim folderName As String

Dim viewName As String

Dim coll As NotesDocumentCollection

Dim vec As NotesViewEntryCollection



folderName = "ReqByReqIdFolder"

viewName = "ReqByID2FolderLookup"



Set db = s.CurrentDatabase		



' * Get environment variable

value$ = s.GetEnvironmentString("currentProject")



Set folder = db.GetView(folderName)

Set vec = folder.AllEntries



Call folder.Refresh

folder.AutoUpdate = False	



' * Remove all documents from folder from last session

Call vec.RemoveAllFromFolder(folderName)	



Set view = db.GetView(viewName)



' * No environment variable has been set

' * Add all documents in view to folder

If (value$ = "") Then

	Set vec = view.AllEntries

	Call vec.PutAllInFolder(folderName, False)		

	Exit Sub

End If	



' * Get all documents from view which are categorized by the value 'value$'

' * Put them in folder

Set coll = view.GetAllDocumentsByKey(value$, True)

Call coll.PutAllInFolder(folderName, False)	



Call folder.Refresh

folder.AutoUpdate = True		

Call folder.Refresh

End Sub

Subject: RE: Removing response documents from folder causes error

You seem to be doing a lot of work to avoid having separate project databases and I’m not sure why this is considered such a problem. What are the user requirements that can’t be met using separate databases?

If the goal is to have overview information on all projects available on one screen, maybe you could create a separate, read-only database, containing data extracted from each of the project databases by a scheduled agent. Or, you might have reports created on demand from the information in all the databases.

If you end up having to create a separate set of views for each project, and you add a new set of views every week, you will quickly drive performance into the ground, with a shuddering crunch, from the combined effect of increasing numbers of documents multiplied by increasing number of views.

You can, of course, use @SetViewInfo to have one view and show just a single category, but this is a pain and there’s at least two annoying bugs (collapse all and select all work in unexpected ways).

One thing you might consider doing to unify the different project databases but keep them in separate NSFs, is to make an automatically calculated outline that shows links to the other project databases. This might either be an Outline design element that’s updated by an agent, or some pass-thru HTML code on the navigation page (this works in the Notes client) with notes:// URL links to the other apps, or you could make the navigation area a form rather than a page, and have a combobox field to select what project the user wants to look at – when they select one you run onchange code to close the current application and open the one they specified.