LotusScript to C API Programming Guide

rtLib Domino Rich Text Management template
Home
Show details for ContentContent
Purchase
Ready-to-use samples
Show details for Online resourcesOnline resources
Forum
Links
Happy readers

Anonymous

login


 

Hosted by Prominic.NET, Inc.
Main topic: Problems using Selective Replication Settings sample code on R5 database

Problems using Selective Replication Settings sample code on R5 database (by Normunds Kalnberzins, 01/20/2004 03:43:43 AM)

Originally the samples (or most of them) were written on R4 some 4 years ago. And before finally posting on website I tested them on 6.0.3, so in theory some of them may not have been tested on R5. However I see no reason why not.

On thing about this sample -- the code "as is" starts working only if it finds any existing replication note (I think it does not create replication notes itself). But as you can see the modified note you had it that way. One other thing is -- I used it on another database than the one the code is running in (maybe with a reason that it did not work on an open one?).

As for the discrepancies you found -- TYPE_TEXT vs. TYPE_TEXT_LIST and items being summary SUMMARY I've seen not prob with the sample as it is, so I did not try to finetune it.

But you can use flag ITEM_SUMMARY when writing formula item in Sub writeFormula

W32_NSFItemAppend (doc.handle, ITEM_SUMMARY ...

where

Const ITEM_SUMMARY = &h0004

The rest of items you mention are written using ReplaceItemValue of NotesDocument that IMO should set them Summary by default. In case it's not true, then you can force them to summary by changing change "update" method of recServer class (I did not try this).

As for TYPE_TEXT_LIST you should be able to re-open the note using a flag OPEN_EXPAND calling NSFNoteOpen routine and re-save it. I added following code at the end of Initialize routine:

   Const   OPEN_EXPAND = &h0004

   Dim hNote As Long

   ' expand text lists

   Set replication = New replicationTable( ndbTarget)   

   If replication.isValid Then

      Set docReplicationNote = replication.getFirst

      Do While Not docReplicationNote Is Nothing

         If W32_NSFNoteOpen (replication.hDb, Val("&h" & docReplicationNote.NoteID) , OPEN_EXPAND, hNote)=0 Then

            W32_NSFNoteUpdate hNote, 0

            W32_NSFNoteClose hNote

         End If

         Set docReplicationNote = replication.getNext

      Loop

   End If

For this to work, I had to make "Public" the member "hdb" in ReplicationTable class -- Public hdb As Long

and add a couple of function declarations to open and close the note:

Const LIB_W32 = "nnotes"

Declare Function W32_NSFNoteOpen Lib LIB_W32 Alias {NSFNoteOpen} (_

Byval db_handle As Long, _

Byval note_id As Long, _

Byval open_flags As Integer, _

note_handle As Long) As Integer

Declare Function W32_NSFNoteClose Lib LIB_W32 Alias {NSFNoteClose} (_

Byval note_handle As Long) As Integer

and strangely enough, after these changes the formula appeared also in "current" database; i.e. when code set the formula in the same db it was running in (that as I mentioned before was not working).