lotus notes consulting, lotus domino consulting

Selective Replication Utility DLL

Version 1.1

Easily add programmatic selective replication to Notes 4.5, 5.x, 6.x, 7.x, and 8.x applications!

The SelRep.dll contains LotusScript- and VB-callable functions for manipulation of a Notes database selective replication formula. This DLL allows Domino developers to programmatically control replication formulas for local databases. For example, a developer could present a wizard-like interface for a user to select document criteria. A Notes selection formula from these criteria could be generated and set in the database. The setting and getting of this formula is achieved with two functions in a script library, along with a DLL. This affords a local "subscription" to user-defined documents during subsequent replication, without the user having any knowledge of formula language or replication settings.

Creating new replicas

For situations where a new local replica needs to be created with a selective replication formula before the first replication, a function is included for creating a replica stub of a database.

Programmatically controlling replication

For situations where you need to programmatically control replication of a local database with a server database, a function is included for checking that the server is available. For example, upon closing a local database you want to prompt the user to replicate with the server to keep all documents synchronized. Only if the user is connected to the network, a prompt appears asking the user if he would like to replicate.

Deploying the DLL automatically

The 200KB DLL needs to exist on any server or workstation that calls the DLL functions. To deploy the DLL to user workstations, this example application includes a subroutine to automatically check for the existence of the DLL on the user's workstation as the database is opened. If the DLL does not exist, a self-extracting copy of the DLL is detached and unzipped to a specified folder on the user's workstation. This self-extracting copy is only 80KB. This subroutine can be called from any event in the application, including the database PostOpen event, any form or button event, or an agent.

LotusScript example

Dim s As New notessession Set db = s.currentdatabase iresult = LSSetDbSelectiveRepl("", db.FilePath, |select region="North America"| ) '... sets the db formula to the string value

Downloadable items


SelRep.zip
121 KB
Contains:
    • SelRep.NSF example database, including
    • SelRep.EXE (contains SelRep.DLL demo version)
    • Documentation



This demo application contains the following examples:

Application usage example

Where you'll find it in the example database

Demo* version of the DLL in a self-extracting EXE file "(dlls)" view
Re-usable code to detach and unzip the self-extracting DLL, only if it does not already exist on the user's workstation Database PostOpen event
"SelectiveReplication" script library, ExtractDLL subroutine
Declaration code for DLL functions "SelectiveReplication" script library, Declarations event
Example code to set a selective replication formula from a button "Set Formula" form, "Set selective replication formula" button.
Example code to call other functions from the DLL "Selective Replication" agent


* Note: the demo version of the DLL included in this application is NOT the real DLL. This demo version of the DLL sets the database replication formula only to "SELECT Eval = @True", regardless of what formula string you pass to it. The demo version is only intended to prove that the DLL works in a customer's environment. The production version of the DLL properly sets the formula to any valid formula expression you pass it. The production version of the DLL is made available to purchasing customers.

 

 

DLL function reference

Function GetDatabaseFormula( server as string, filename as string ) as string
Returns a string equal to the current selective replication formula that would normally appear in the Replication Settings window for the specified database.

server - can be blank for local workstation
filename - filename of current database

Function SetDatabaseFormula( server as string, filename as string, formula as string ) as integer
Sets the selective replication formula that would normally appear in the Replication Settings window for the specified database. If a formula already exists, this function will overwrite it.

server - can be blank for local workstation
filename - filename of current database
formula - valid Notes selection formula string

Returns:
0 if successful, otherwise an error code.
1 formula does not compile
2 requested database not available
3 failed to create new selrep note

Works on any database, including a database replica stub that was created by CreateReplicaStub function (below) and that has not been initialized yet. This will be used before initial replication to filter the incoming notes that replicate.

Function CreateReplicaStub( SourceDatabaseServer As String, SourceDatabaseFileName As String, DestinationServer As String, DestinationDbName as String ) As Boolean
Creates an uninitialized replica stub from the specified database, on the specified server. The current Notes ID must have replica creation privileges on the target server. Only the Access Control List is copied to the new stub database, and the stub cannot be used until a full replication has occurred. Returns True if successful, otherwise False.

Function IsServerAvailable( ServerName As String ) As Boolean
Given a server name (which should be in either abbreviated or canonical form), returns True if the server is reachable over the network, otherwise it returns False.

Instructions for adding automatic DLL detach and self-extract deployment to your own application

  1. Copy the Designdll form, (dlls) view, and SelectiveReplication script library to your target database.
  2. In the script library, ExtractDLL subroutine, change the dataDir$ = "c:\temp" to the folder where you will place the DLL on the users' workstations.
  3. In the script library, Declarations event, also change the "c:\temp\selrep.dll" to reference the actual path where you will place the DLL on the users' workstations.

Requirements

Client versions: Lotus Notes 4.57 through 8.0
Platforms: Win95/Win98/Win2000/WinNT/XP

Pricing

Customized pricing available. Please contact us at MartinScott Support for a custom quote based on number of users.

Headquarters / DC
8200 Greensboro Dr, Suite 900
McLean, VA 22102
703.462.5435 Phone
703.995.4738 Fax
Seattle
4810 Point Fosdick Drive NW #318
Gig Harbor, WA 98335
253.234.5390 Phone
703.995.4738 Fax
Philadelphia / DE
Newark, DE 19711
703.281.6724 Phone
703.995.4738 Fax