Home > Domino Tips > Developer > QuickTips > Find all databases associated with a template
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

QUICKTIPS

Find all databases associated with a template


Susan Virgilio
09.14.2005
Rating: -4.00- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


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.

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.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
QuickTips
View hidden fields on Lotus Notes/Domino forms
A bevy of Notes/Domino development tips
How to protect your Lotus Notes application design
Merging views
Stop an agent without shutting down the Amgr task
Collapsing outlines
How to make Notes view icons run code
Verifying user's date setting and time zone on local PC
Load design for a single database
Options for changing passwords

Lotus Notes Domino Coding and Development
Tutorial: 30 LotusScript tips
A bevy of Notes/Domino development tips
A Formula language for Lotus Notes introduction -- 7 tips in 7 minutes
Top 10 Notes/Domino developer tips of 2006
Sending and logging faxes from Lotus Notes and Domino
Accessing documents in a Lotus Notes database
A smorgasbord of Notes/Domino development tips
Creating a Lotus Notes view column categorized by month
A project-tracking application for Lotus Notes Domino
What the new Office means for developers

Lotus Notes Domino Database Management
Domino Domain Monitoring hints and gotchas
LotusScript code rebuilds corrupted busytime.nsf file
LotusScript agent automates selective mail file replication
Configuring Domino Domain Monitoring (DDM)
How to move Notes databases off Domino 8 servers and save disk space
What is Notes 8.5's DAOS (Domino Attachment and Object Storage) feature?
LotusScript agent indexes Lotus Notes/Domino databases
An introduction to Domino Domain Monitoring (DDM)
'Customize this view' options are disabled in Lotus Notes databases
LotusScript button saves time searching large Lotus Notes databases

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

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.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts