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