Setting replication formula using script => formula is neglected, though settings are saved

Hello,

We’re thinking of a procedure to distribute a database that contains a few thousands of documents containing large attachments to about 150 laptops.

In an attempt to limit the number of documents in the local replica’s (as laptop-users usually consider themselves to be too busy to wait for a few MB to replicate), I’m experimenting with replication-formulas.

The goal is to have users decide what subset of documents they want to replicate, up to now I’ve come up with the following :

  1. I create an empty replica, using ‘@False’ as replication-formula

  2. In the Initialize-event of the database, I set the replication-formula. This is my (testing-)code :

Sub Initialize

Dim session As New NotesSession

Dim notesReplicInfo As NotesReplication

Dim notesReplic As NotesReplicationEntry



Set db = session.CurrentDatabase



If db.Server = "" Then

	Set notesReplicInfo = db.ReplicationInfo

	

	Set notesReplic = notesReplicInfo.GetEntry("-",session.UserName)

	If Not notesReplic Is Nothing Then Call notesReplic.Remove

	

	Set notesReplic = notesReplicInfo.GetEntry("-",session.UserName,True)

	notesReplic.Formula = |(Field1 = "1") & (Field2 = "2")|

	Call notesReplic.Save

	Call notesReplicInfo.Save

End If

End Sub

  1. In the PostOpen-event of the database, I replicate the database :

Sub Postopen(Source As Notesuidatabase)

Call db.replicate("slndev02")

End Sub

The result of replicating ? An empty database …

When verifying the replication-settings, everything looks exactly the same as when setting the replication-formula manually, which causes the correct subset of documents to be replicated.

Can anyone shed some light on this mistery from the twilight-zone ?

Philippe

Subject: Setting replication formula using script => formula is neglected, though settings are saved

A colegue and I are trying something similar to be used for preparing a DOLS subscription CD for hundreds of users, each requiring a different set of documents.

We do do something slightly diferently, but the main idea is the same.

We create a replica stub of the database by using the notes client, and telling it to replicate with the background replication task, then attaching the file into a Notes Document in the database before the first replication).

When we need to create a new replica, we detatch it onto the local HD. We then set the replica settings up so that RepUser = “993” (as an example) using lotus script.

When we replicate the database, we either get everything or nothing, never the documents we are actualy after.

The same formula in a view always produces the correct result.

If we set the replication formula manualy, then the documents replicate correctly.

The formula we are using is:

RepUsers := 935 ;

SELECT (@IsUnavailable(Users) | (Users *= RepUsers))

The value for RepUsers is multivale and is set up via script. Users is also a multi value field. We are after all documents where Users is not present, but only the documents with users, where at least one of the RepUsers are in the Users field in the documents.

Has anyone else had this problem, and more importantly, figured out how to programaticaly solve it?

Thanks in advance.

Subject: RE: Setting replication formula using script => formula is neglected, though settings are saved

I have the same problem - has anyone found a solution to this?