Skip to main content
This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.
Information Mgmt
New to Lotus
How to buy
Live demos
Technical library
Forums & community
Java™ technology
Open source
SOA and Web services
Web development
My developerWorks
About dW
Submit content

developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum



PreviousPrevious NextNext

Agent to Update Comments on All Design Elements
Kevin Pettitt 8.Jun.07 02:05 PM a Web browser
Applications Development All Releases All Platforms

I wrote an agent that asks for a comment "prefix" via an inputbox, then runs through all the design elements in a database that accept comments and either puts the entered value in the $Comment field, or prepends the entered value to an existing comment (e.g. "newvalue - original comment"). Note that I couldn't get views to work using the NotesNoteCollection approach so I fell back to using Damien Katz's DbDesign class for views (look here:,dbdesign). Just add the script library from that download to your database and this agent will compile properly.

************ begin code ******************
'Update Comment on All Elements:

Option Public
Use "DbDesign"

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim nc As NotesNoteCollection
Dim note As NotesDocument
Dim nid As String

'Instantiate DBDesign objects for views, which don't work with NotesNoteCollection
Dim dbdesign As DatabaseDesign
Dim views As Variant
Dim viewaliases As Variant

Dim CommentString As String

CommentString$ = Inputbox$("Enter a Comment String (will prepend any existing comment):")
If CommentString$ = "" Then
Messagebox "Action Cancelled"
Exit Sub
End If

Set db = session.CurrentDatabase
Set dbdesign = createDatabaseDesign( db)
views = dbDesign.viewDocuments

Set nc = db.CreateNoteCollection(False)
'Choose elements where $Comment field is present
nc.SelectFramesets = True
nc.SelectPages = True
nc.SelectForms = True

'Views treated as a special case because of NotesNoteCollection bug
' nc.SelectViews = True
If Not Isempty( views) Then
Forall viewdoc In views
If Instr(viewdoc.~$Comment(0), CommentString$) = 0 Then
'If the comment string doesn't already exist in this comment, prepend it
If viewdoc.~$Comment(0) <> "" Then
'insert a dash after string to separate it from existing comment
viewdoc.~$Comment = CommentString$ + " - " + viewdoc.~$Comment(0)
viewdoc.~$Comment = CommentString$
End If
Call viewdoc.Save(True, False)
End If
End Forall
End If

nc.SelectFolders = True
nc.SelectAgents = True
nc.SelectOutlines = True
nc.SelectSubforms = True
nc.SelectScriptLibraries = True
nc.SelectImageResources = True
nc.SelectStyleSheetResources = True
nc.SelectDataConnections = True
'Missing files, applets, web services - might work to select all elements then deselect ones that won't apply

Call nc.BuildCollection

If nc.Count = 0 Then
Messagebox "No elements found"
Exit Sub
End If

nid = nc.GetFirstNoteId

While nid <> ""
Set note = db.GetDocumentByID(nid)
If Instr(note.~$Comment(0), CommentString$) = 0 Then
'If the comment string doesn't already exist in this comment, prepend it
If note.~$Comment(0) <> "" Then
'insert a dash after string to separate it from existing comment
note.~$Comment = CommentString$ + " - " + note.~$Comment(0)
note.~$Comment = CommentString$
End If
Call note.Save(True, False)
End If
nid = nc.GetNextNoteId(nid)

Messagebox "Finished"

End Sub

Accessing the View Comment field pr... (Joel Phelan 10.Aug.06)
. . EDITED - Accessing the View Comment... (Esther Strom 10.Aug.06)
. . . . RE: EDITED - Accessing the View Com... (Joel Phelan 11.Aug.06)
. . . . . . RE: EDITED - Accessing the View Com... (Stan Rogers 11.Aug.06)
. . . . . . . . RE: EDITED - Accessing the View Com... (Joel Phelan 11.Aug.06)
. . . . . . . . . . RE: EDITED - Accessing the View Com... (Esther Strom 14.Aug.06)
. . Agent to Update Comments on All Des... (Kevin Pettitt 8.Jun.07)

Document Options

  Document options
Print this pagePrint this page

Search this forum

Forum views and search

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Advanced search

Member Tools

RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds


Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds


IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums

 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite