
ADDRESS BOOK
Sort Group Members In Your Public Address Book
Mike Trotta  08.24.1999
Rating: --- (out of 5)




It is difficult to manage groups with a long list of members. Here is a nice easy way to help sort those nasty group lists. This utility is made up of small piece of lotus script combined with a simple database used to sort the list.
This utility will sort a single group or a selection of groups. Instead of writing a sort routine I used the built in sort capabilites of a notes view to handle the sorting. The code below reads the group list sends it to the SORTDB for sorting then writes its back to the group list in sorted order.
Code
If I could upload the sort database I would. Either I don't know how or Lotus 411 will not allow it STEP1 will take a little longer. So you can either get a developer to create the SORTDB for you or you can try it yourself. This is an excellent chance for you to broaden your Lotus Notes skills if you have never designed a database before. Creating the SORTDB is as simple as database development gets with Lotus Notes.
STEP1: On your server: Create a very simple database called SORTDB. File-->Database-->New Fill in the Server, title and Filename. FILENAME must be SORTDB.NSF Use the template called BLANK click OK Click on the new ICON Create-->Design-->Form Create-->Field / NAME=SORTFIELD Close and Save form as SORTFORM Create-->Design-->View / set NAME = SORTVIEW / click on SHARED /click OK Goto VIEWS in the DESIGN section and double-click the untitled view Double-Click on the first column in the view to activate the column properties box. set Name = SORTFIELD Click on the SORT tab / set SORT = ASCENDING / Close the properties box Right mouse click on the view to activate the view properties box. set NAME = SORTVIEW / Close the prpoerties box Exit and save the view.
STEP2: Create an agent in your public address book. Copy the code into the initialize section. Modify the 3rd DIM statement according to your server name. The server name should be the same server that the SORTDB is located.
Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Dim Sortdb As New Notesdatabase("YOUR SERVER NAME HERE","SORTDB.NSF") Dim view, Sortview As NotesView Dim doc, Sortdoc As NotesDocument Dim Sortcollection As NotesDocumentCollection Dim i As Integer Set Sortcollection = Sortdb.AllDocuments Call Sortcollection.RemoveAll(True) Set Sortview = Sortdb.GetView("SortView") Set db = session.CurrentDatabase Set doc = session.DocumentContext Set item = doc.GetFirstItem( "Form" ) If item.text <> "Group" Then Messagebox "You can only run this agent from the groups view...!!!" End End If Set item = doc.GetFirstItem( "Members" ) Forall member In doc.members Set Sortdoc = New NotesDocument(Sortdb) Sortdoc.SortField = member Call Sortdoc.Save( False, True ) End Forall Call Sortview.Refresh Set Sortcollection = Sortdb.AllDocuments Set Sortview = Sortdb.GetView("SortView") Call doc.replaceitemvalue( "Members","" ) For i = 1 To Sortcollection.Count Set Sortdoc = Sortview.GETNthDOCUMENT(i) Set Sortitem = Sortdoc.GetFirstItem( "SortField" ) Call item.AppendToTextList( Sortitem.text ) Next Call doc.Save( False, True ) End Sub
 |

|
Rate this Tip
|
To rate tips, you must be a member of SearchDomino.com. Register now
to start rating these tips. Log in if you are already a member.
|


');
// -->
DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.
|
 |
|
|
 |
|
 |