Is there an @command to enable replication for a selected database

Here is button formula to add a database to user's workspace, open, then initiate replication.  I need to be able to set replication "on" or "enable" replication for the LOCAL REPLICA after it's replicated for future replications, or place a checkmark beside the local replicated db.  Can this be done in formula ?
@Command([AddDatabase]; "servername" : "c_dir/Rpt.nsf" ) ;
@Command([FileOpenDatabase]; "servername" : "c_dir/Rpt.nsf") ;
@Prompt([Ok];"Local Replica of Reports Database" ; "Press OK to continue. You will then be prompted to locally replicate this application. You can respond by clicking OK or Cancel.") ;
@Command([FileNewReplica]) ;
@Command( [Replicator] )

Open in new window

KTTKTTAsked:
Who is Participating?
 
Sjef BosmanConnect With a Mentor Groupware ConsultantCommented:
Make two buttons? Formula and Script cannot be combined in one event.

Send them a link of the database, and put some code in the PostOpen event of the database??
0
 
Sjef BosmanGroupware ConsultantCommented:
I suppose that's not necessary, the database should be picked up automatically. I hope. But apparently it isn't, since you're asking the question.

See the Designe Help database, open the Index, and look under @Commands  for commands starting with Replic

There is, in LotusScript, a Replicate method in a NotesDatabase object. You could put that in an agent, and activate the agent from Formula. Would that be a solution??
0
 
KTTKTTAuthor Commented:
Yes, the db. is picked up automatically and it successfully replicates, but also need it to enable replica for future replication.  There are no @commands that will do it from my research and trial and error.  I did see in help.   Is there a way I can combine both formula and the following script I found in Help to enable the current local replica.  The button will be distributing via email, so an agent may not be feasible for this case.
This script enables replication in databases where replication has been disabled.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim rep As NotesReplication
Set db = session.CurrentDatabase
Set rep = db.ReplicationInfo
If rep.Disabled Then
  rep.Disabled = False
End If
Call rep.Save()
0
 
KTTKTTAuthor Commented:
The button formula code below opens server copy - adds connection:
@Command([AddDatabase]; "servername" : "c_dir/Rpt.nsf" ) ;
@Command([FileOpenDatabase]; "servername" : "c_dir/Rpt.nsf") ;
@Prompt([Ok];"Local Replica of Reports Database" ; "Press OK to continue. You will then be prompted to locally replicate this application. You can respond by clicking OK or Cancel.") ;
@Command([FileNewReplica]) ;
@Command( [Replicator] )
------------------------------------------------------
I'll keep this button "as is" .  I added this script at your suggestion to the PostOpen event of the Database Script to enable replication after opening:
'This script enables replication in databases where replication has been disabled.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim rep As NotesReplication
Set db = session.CurrentDatabase
Set rep = db.ReplicationInfo
If rep.Disabled Then
  rep.Disabled = False
End If
Call rep.Save()
---------------------------
My original question was actually referring to the replicator page - was wondering if there was a way to programmatically place a check mark under "Enabled" for the current db., but I may have to leave that to the user to determine if they want this option checked for replication.   I guess the only significance here is that when you click "Start Now", all checked items replicate; otherwise, the user can still manually initiate replication.
0
 
Sjef BosmanGroupware ConsultantCommented:
There must be a way to do what you want automatically, but I'm not familiar with it. Sorry...

If you can live with the current method, I think that would be great, for pursuing this matter to the end could cost a lot of time.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.