Updating Groups With A Single Click

This Content Component encountered an error
We have numerious groups that we maintain for each of our locations. It was
very time consuming keeping the groups updated or it didn't even get done. So,
I created this agent in the Public name and address book that would refresh the
groups for us. Here is the code.
Sub Build_Fields

' Dim arrays for each location. This array will hold the names of all
' the prople at the location. This will be used to update the group document
Dim Syr_Names() As String
Dim Gb_Names() As String
Dim Cd_Names() As String
Dim Sa_Names() As String
Dim Fs_Names() As String
Dim Cn_Names() As String
Dim WS_Names() As String
Dim OR_Names() As String
Dim GS_Names() As String

' The arrays are not assigned a range until all the records are counted
' These vars will be used to cound the records
Dim Syr_Ctr As Integer
Dim Gb_Ctr As Integer
Dim Cd_Ctr As Integer
Dim Sa_Ctr As Integer
Dim Fs_Ctr As Integer
Dim Cn_Ctr As Integer
Dim WS_Ctr As Integer
Dim OR_Ctr As Integer
Dim GS_Ctr As Integer

Syr_Ctr = 0
Gb_Ctr = 0
Cd_Ctr = 0
Sa_Ctr = 0
Fs_Ctr = 0
Cn_Ctr = 0
WS_Ctr = 0
OR_Ctr = 0
GS_Ctr = 0

Dim Session As NotesSession
Set Session = New NotesSession
Dim db As NotesDatabase
Set db = New NotesDatabase("Corp/PSL/US","Names.nsf")
Dim view As NotesView
Set view = db.getview("People")
Dim Doc As NotesDocument
Set doc = view.GetFirstDocument
'using the "Location" field determine how many people are at each location.
While Not ( doc Is Nothing )
Location=Doc.Location
Select Case location(0)
Case "Syracuse"
Syr_Ctr = Syr_Ctr + 1
Case "Greensboro"
Gb_Ctr = Gb_Ctr + 1
Case "Concord"
Cd_Ctr = Cd_Ctr + 1
Case "Concord Warehouse"
Cd_Ctr = Cd_Ctr + 1
Case "San Antonio"
Sa_Ctr = Sa_Ctr + 1
Case "Canada"
Cn_Ctr = Cn_Ctr + 1
Case "Field Sales"
Fs_Ctr = Fs_Ctr + 1
Case "Ortronics"
OR_Ctr = OR_Ctr +1
Case "Watt Stopper"
WS_Ctr = WS_Ctr +1
Case "Gastonia"
GS_Ctr = GS_Ctr +1
End Select
Set doc = view.GetNextDocument( doc )
Wend

Syr_Ctr = Syr_Ctr - 1
Gb_Ctr = Gb_Ctr -1
Cd_Ctr = Cd_Ctr - 1
Sa_Ctr = Sa_Ctr -1
Fs_Ctr = Fs_Ctr -1
Cn_Ctr = Cn_Ctr -1
OR_Ctr = OR_Ctr -1
WS_Ctr = WS_Ctr -1
GS_Ctr = GS_Ctr -1

'Redim the arrays to be the size needed.
Redim Syr_Names(Syr_Ctr) As String
Redim Gb_Names(Gb_Ctr) As String
Redim Cd_Names(Cd_Ctr) As String
Redim Sa_Names(Sa_Ctr) As String
Redim Fs_Names(Fs_Ctr) As String
Redim Cn_Names(Cn_Ctr) As String
Redim OR_Names(OR_Ctr) As String
Redim WS_Names(WS_Ctr) As String
Redim GS_Names(GS_Ctr) As String

Syr_Ctr = 0
Gb_Ctr = 0
Cd_Ctr = 0
Sa_Ctr = 0
Fs_Ctr = 0
Cn_Ctr = 0
OR_Ctr = 0
WS_Ctr = 0
GS_Ctr = 0


' read the address book again this time storing the users name in the
array.
Set doc = view.GetFirstDocument
While Not ( doc Is Nothing )
Location=Doc.Location
OwnerName = Doc.Owner
Select Case location(0)
Case "Syracuse"
Syr_Names(Syr_Ctr) = OwnerName(0)
Syr_Ctr = Syr_Ctr + 1
Case "Greensboro"
Gb_Names(Gb_Ctr) = OwnerName(0)
Gb_Ctr = Gb_Ctr + 1
Case "Concord"
Cd_Names(Cd_Ctr) = OwnerName(0)
Cd_Ctr = Cd_Ctr + 1
Case "Concord Warehouse"
Cd_Names(Cd_Ctr) = OwnerName(0)
Cd_Ctr = Cd_Ctr + 1
Case "San Antonio"
Sa_Names(Sa_Ctr) = OwnerName(0)
Sa_Ctr = Sa_Ctr
This was first published in November 2000

Dig deeper on Domino Resources

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close