• Browse Blogs
  • My Blog
  • My Updates

+Tags Get help with tags?

+ Similar Entries

photo

Adding the "X" Facto...

Blog:  Beyond The Ye...
Peter Presnell
Updated 
No RatingsRatings 0     CommentsComments 2
photo

Tagging Design Eleme...

Blog:  Beyond The Ye...
Peter Presnell
Updated 
No RatingsRatings 0     CommentsComments 1
photo

Add Discussion Threa...

Blog:  Beyond The Ye...
Peter Presnell
Updated 
No RatingsRatings 0     CommentsComments 2
photo

New Video Includes S...

Blog:  Beyond The Ye...
Peter Presnell
Updated 
No RatingsRatings 0     No CommentsComments 0
photo

Fun with BES server

Blog:  You need Note...
George Paglia
Updated 
No RatingsRatings 0     CommentsComments 1

+ Bookmarks

+ Blog Authors  

Adding Datasets & Datagrids to Notes Applications - Part 2

Peter Presnell |   | Tags:  .dominoframework dataset datagrid folders | Comments (0)  |  Visits (642)
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.
  1. 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.
  2. 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:-
  1. Recognize a dataset that already exists as a view
  2. Allow a specific (existing) folder design element to be used.
  3. Allow an existing view/folder to be used as a template for a new folder
  4. 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(NewColumn))
Column.Title$ = Me.Label(FieldIndex%)
If Not (Isnull(Arraygetindex(Me.SortBy,NewColumn))) Then Column.IsSorted = True
FieldIndex% = FieldIndex% + 1
End Forall
Else
Evaluate(|@UpdateViewDesign("| + Me.FolderName$ + |";"| + Me.TemplateView$ + |")|)
Call Dataset.Refresh()
End If
End If
End If

' Refresh the view/folder

Call Dataset.Refresh()
Set Rebuild = Dataset

End Function
The following are some of the features that can be added to an application using the dataset/datagrid approach:-
  1. Provide the functional equivalence of emedding multiple categories of a view
  2. Embed a single category view in which it is still possible to do collapse all/expand all
  3. Provide the ability to export data from an application in which a predefined set of rows (documents) & columns (fields) are exported.  The user can also have the option of selecting which of these columns they wish to export.
  4. Provide an alternative to views without the overhead of maintaining view contents.  For relative static data folder contents can be rebuilt via a scheduled agent.  Datasets used infrequently can have their content built as part of the folders query open event.
  5. Provide a dynamic report buiulding capability
  6. Provides an alternate approach to search building in which the use can even define the columns they wish to see in their search results
No RatingsRatings 0

Comments (0)

There are no comments to display Add a Comment Add a Comment

Previous |  Main  | Next
Skip to main content link. Accesskey S
IBM Lotus Connections Help Tools About