I would appreciate any tips/ideas on how to deploy local replica of our office database to field staff.
Currently we use the following method to install the local replica on each laptop before it goes out into the field.
We use a batch file to open an installer database. From here we run following agent from a button.
Sub Click(Source As Button)
Dim session As New NotesSession
Dim parentdb As NotesDatabase
Dim replica As NotesDatabase
Set parentdb = session.getdatabase(“server”, “databasename”)
Set replica = parentdb.createreplica (“”, “nameofreplicadb”)
Dim dbName As String
dbName$=“replicadb”
Dim ReplicaDb As NotesDatabase
Set ReplicaDb = session.GetDatabase(“”,dbName$)
Dim rep As NotesReplication
Dim re As NotesReplicationEntry
If Not Replicadb.IsOpen Then
Messagebox “ERROR …No local replica created”
Exit Sub
End If
Dim eString As String
eString = |( Form = “Form1” & @Name([CN]; @UserName) = InterviewerNme & VariableName !=“New”) || ( Form = “Form2” ) || ( Form = “Form3” & @Name([CN]; @UserName) = InterviewerNme)|
REM Get source and destination computers
Dim sourcedb As String
Dim destinationdb As String
sourcedb$ = “-”
destinationdb$ = session.UserName
REM Get replication entry
Set rep = ReplicaDb.ReplicationInfo
Set re = rep.GetEntry(sourcedb$, destinationdb$, True)
If re Is Nothing Then
Messagebox _"No replication entry for " & sourcedb$ & _
" and " & destinationdb$, _
“No such replication entry”
Exit Sub
End If
rep.Priority = DB_REPLICATION_PRIORITY_LOW
re.Formula = eString
'rep.Disabled = True ‘’'Temporarily disable replication
Call re.Save()
Call rep.Save()
Call Replicadb.Replicate(“ServerName” ) ’ replicate immediately
ans = Messagebox (“SUCCESS …New local replica created” & Chr(10) & “Do you want to open the replica now ?” ,MB_ICONQUESTION + MB_YESNO,“Open Database”)
If ans = IDYES Then
Dim workspace As New NotesUIWorkspace
Call workspace.OpenDatabase _
( “”, dbName$ , , , False, True )
End If
End Sub
Our code is doing the following…
1.Open the database on server which we want to create local replica of
2.Create local replica of this database on the laptop we are logged on to.
3.Find this local replica and apply the formula & other replication setting.
4.Open this newly created replica.
While this agent works for the most part it does require us having to run the agent, manually replicate the database with the server copy so that the formula kicks in, also change some settings i.e. switch off scheduled replication and apply deletions of the local replica replication settings.
I would be interested in hearing from others who deploy local replica’s to field staff.
Many thanks