Did you ever want to find all databases that refresh from a particular template? This will provide you with a list of databases that use the template along with a count of how many were found.
This code can be used several different ways. For my purposes, I created a form with the following fields:
ServerName (text, editable) TemplateName (text, editable) Number (text, computed, default value Number) databases (text, computed, default value databases)
Then I created a button with the following code:
Sub Click(Source As Button) Dim workspace As New NotesUIWorkspace Dim uidoc As NotesUIDocument Set uidoc = workspace.CurrentDocument Dim doc As NotesDocument Set doc = uidoc.Document Dim db As NotesDatabase Dim strServ As String strServ = doc.ServerName(0) If strServ = "" Then Msgbox "You must fill in the Server you want to search on!" Call uidoc.GoToField("ServerName") Exit Sub End If Dim dbdir As New NotesDbDirectory(strServ) Dim strNTF As String strNTF = doc.TemplateName(0) If strNTF = "" Then Msgbox "You must fill in the Template name to search for!" Call uidoc.GoToField("TemplateName") Exit Sub End If Dim cnt As Integer cnt = 0 Set db = dbdir.GetFirstDatabase(DATABASE) While Not (db Is Nothing) If db.DesignTemplateName = strNTF Then doc.databases = db.Title & " FILE: " & db.filepath & Chr(10) & doc.databases(0) cnt = cnt + 1 End If Set db = dbdir.GetNextDatabase Wend If doc.databases(0) = "" Then doc.databases = "NO MATCH FOUND!!" End If doc.Number = Str(cnt) + " databases found" End Sub
To use, simply enter a server name and template name, then click the button.
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip exchange by member Susan Virgilio. Please let others know how useful it is via the rating scale at the end of the tip. Do you have a useful Notes/Domino tip or code to share? Submit it to our bimonthly tip contest and you could win a prize and a spot in our Hall of Fame.