All entries tagged with folders
In part 1I discussed the concept of a dataset and how it can be applied to Notes application. While Notes views are a representation of a dataset I wanted to focus on the opportunities of generating the dataset at run time. e.g. it becomes possible to take input from the application/user to build the data collection.
Internally, the easiest way to represent a dataset is a NotesDocumentCollection. One of the issues with this class is there is presently no easy way to store such a dataset, even for the duration of a session. Nor is there an easy way to display its contents within an application. Notes provides views/folders as the only effective way of displaying a collection of documents.
- Views have a number of issues.. The contents of a view are based upon a specified selection formula. Once created a large amount of server resources are devoted to manitaining the contents of views each and every time the contents of database change. For this reason the number of views in an application (especially large applications) should always be kept to a practical minimum.
- Folders seems a much better match for a dynamic run-time dataset as they provide the same basic look/feel but do not carry an overhead to maintan their content. The process of taking a document collection and adding it toi a view is a very simple one.
The .Domino Framework's DominoDataset class provides a Rebuild method which takes a dataset and gives it a phyiscal form using folders. We tare then able to mimic the functionality of a datagrid control using the Notes folder control which can be displayed directly or embedded on a form or page. To maximize flexibility options exist to:-
- Recognize a dataset that already exists as a view
- Allow a specific (existing) folder design element to be used.
- Allow an existing view/folder to be used as a template for a new folder
- Build a new folder from scratch based upon the field defined in the dataset
'/** ' * Place the dataset into a folder so that is able to be displayed ' */ Function Rebuild() As NotesView Dim Collection As NotesDocumentCollection Dim Column As NotesViewColumn Dim Entries As NotesViewEntryCollection Dim FieldIndex As Integer Dim Dataset As NotesView ' Locate exisging view/folder Set Dataset = iDocument.ParentDatabase.GetView(Me.Foldername$) ' For folders, empty the content If (Not Dataset Is Nothing) Then If (Dataset.IsFolder) Then Set Entries = Dataset.AllEntries Call Entries.RemoveAllFromFolder(Me.Foldername$) End If End If ' Add documents to folder If (Dataset.IsFolder) Then Set Collection = Me.AllDocuments Call Collection.PutAllInFolder(Me.FolderName$) Set Dataset = iDocument.ParentDatabase.GetView(Me.Foldername$) ' Set folder name and alias If (Dataset.Aliases(0) <> Me.FolderName$) Then Dataset.Aliases = Me.FolderName$ If (Dataset.Name <> Me.Title) Then Dataset.Name = Me.Title$ ' For dynamic folders, refresh design of folder. ' If a template view is provided, refersh from that else build the folder design based upon the dataset definition. If (Me.StoreData$ = ENUM_STORE_DATA__DYNAMIC_FOLDER) Then If (Me.TemplateView$ = "") Then If (Not Isempty(Dataset.Columns)) Then Forall ExistingColumn In Dataset.Columns Call Dataset.RemoveColumn(ExistingColumn) End Forall End If Forall NewColumn In Me.Fields Set Column = Dataset.CreateColumn(Dataset.ColumnCount%+1,Cstr(NewColumn),Cstr
|