Last week I began working on a project for the Lotus Notes platform. This project was designed for learning purposes, in order to understand the concepts of Lotus Notes.
The application is composed of two forms, one for items and one for categories .The Form for elements contains a field for the item’s name and another field is used for the item’s. The other form contains a field for the name of the category and a second field for a brief description of the category.
To view the items and categories I have built two views, one called “All Items” and the second “Categories”.
The operations of addition, deletion and update on items were made correctly. First issues appeared when handling categories.
The first problem I had was when deleting categories. This issue occurs when trying to delete a category. By removing this category all items that use this category lose their category information. To solve this problem I made a Lotus script that was called when deleting a category. This script is checking to see if that category was used by items. If that category was used by items, the deletion was not allowed and the user is informed of this with an warning message. If the category wasn’t used by any item the deletion could be done.
Sub Click(Source As Button) Dim session As New NotesSession Dim db As NotesDatabase Dim selectedDocID As NotesDocument Dim selectedDocIDString As String Dim itemsView As NotesView Dim ws As New NotesUIworkspace Dim doc As NotesDocument Dim i As Integer Dim viewCol As NotesViewEntryCollection Dim viewEntry As NotesViewEntry Set db = session.CurrentDatabase Set itemsView = db.GetView("All Items") Set viewCol = itemsView.AllEntries selectedDocIDString = session.GetEnvironmentString("$viewSelection", False) If(selectedDocIDString <> "") Then Set selectedDocID = db.GetDocumentByUNID(selectedDocIDString) End If For i = 1 To viewCol.Count Set viewEntry=viewCol.GetNthEntry(i) Set doc=viewEntry.Document If (doc.GetItemValue("Category")(0) = selectedDocID.GetItemValue("Name")(0)) Then Messagebox "You can't delete this category! It is assigned to an existing item." Exit Sub End If Next selectedDocID.Remove(True) ws.ViewRefresh End Sub |
The second problem I encountered was in changing the information in the category’s name. Items that use this category lost this information after the category’s name was changed. This problem was solved by another Lotus script. After a category is saved with a different name, items that used the old name of the category were updated with the new name.
Sub Postopen(Source As Notesuidocument) Dim session As New NotesSession Dim db As NotesDatabase Dim selectedDocID As NotesDocument Dim selectedDocIDString As String Set db=session.currentdatabase selectedDocIDString = session.GetEnvironmentString("$viewSelection", False) If(selectedDocIDString <> "") Then Set selectedDocID = db.GetDocumentByUNID(selectedDocIDString) End If Call session.SetEnvironmentVar( "oldCategory", selectedDocID.GetItemValue("Name")(0) ) End Sub |
Sub Postsave(Source As Notesuidocument) Dim session As New NotesSession Dim db As NotesDatabase Dim viewcol As NotesViewEntryCollection Dim viewentry As NotesViewEntry Dim itemsView As NotesView Dim selectedDocID As NotesDocument Dim selectedDocIDString As String Dim ws As New NotesUIworkspace Dim doc As NotesDocument Dim item As NotesItem Dim oldCategory As String Dim newCategory As String Set db=session.currentdatabase Set itemsView = db.GetView("All Items") Set viewcol=itemsView.AllEntries selectedDocIDString = session.GetEnvironmentString("$viewSelection", False) If(selectedDocIDString <> "") Then Set selectedDocID = db.GetDocumentByUNID(selectedDocIDString) End If oldCategory = session.GetEnvironmentString("oldCategory") newCategory = selectedDocID.GetItemValue("Name")(0) If (oldCategory <> newCategory) Then For i = 1 To viewcol.count Set viewentry=viewcol.GetNthEntry(i) Set doc=viewentry.Document If (doc.GetItemValue("Category")(0) = oldCategory) Then Set item = doc.ReplaceItemValue("Category", newCategory ) Call doc.Save( True, True ) End If Next End If End Sub |
For further information see:
http://www-01.ibm.com/software/lotus/
https://www.ibm.com/developerworks/lotus/community/
http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp
Finally, there’s another very important peculiarity of what does Cialis that brings it so high above its alternatives. It is the only med that is available in two versions – one intended for use on as-needed basis and one intended for daily use. As you might know, Viagra and Levitra only come in the latter of these two forms and should be consumed shortly before expected sexual activity to ensure best effect. Daily Cialis, in its turn, contains low doses of Tadalafil, which allows to build its concentration up in your system gradually over time and maintain it on acceptable levels, which, consequently, makes it possible for you to enjoy sex at any moment without having to time it.