Skip to main content
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



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

Notes/Domino 6 and 7 Forum

developerWorks

  

Sign in to participate 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: http://www-10.lotus.com/ldd/sandbox.nsf/ecc552f1ab6e46e4852568a90055c4cd/11f180e35d280d38852568b7005c0382?OpenDocument&Highlight=0,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)
Else
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)
Else
note.~$Comment = CommentString$
End If
Call note.Save(True, False)
End If
nid = nc.GetNextNoteId(nid)
Wend

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
Author
Category
Platform
Release
Advanced search

Sign In or Register

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

Member Tools


RSS Feeds

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

Resources

 Resources
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

Wikis

 Wikis
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