Function EN Version 4.50

@PushAndReplace

Database NotesAdmin NotesSystem Replication

Syntax

@PushAndReplace(FROMDBHANDLE1;TODBHANDLE2;FORMULA3;FN4;NOTECLASSES5;FNREPLICATIONFLAGS6;FNLISTERROR7;TEXTLISTActKey;TEXTLISTKeyFieldName;TEXTLISTReplaceFieldName;TEXTLISTTargetFieldName;FNLISTTargetFieldFlags;FNLISTOperationFlags;TEXTLISTDefaultFieldName;TEXTLISTDefaultValue;TEXTRemoveFieldNamesFieldName;TEXTLISTRemoveFieldNames);

Description

Replicates the database with the DBHANDLE FROMDBHANDLE1 with the database with the DBHANDLE TODBHANDLE2 in the direction from FROMDBHANDLE1 to TODBHANDLE2, replicating only the documents that match the Notes-compatible selection formula TEXT FORMULA3 and den NOTECLASSES NOTECLASSES5 .
The databases do not have to be replicas of each other.

The documents in the DB with the DBHANDLE TODBHANDLE2 are modified according to this corresponding lists
TEXTLIST TEXTLISTActKey,
TEXTLIST TEXTLISTKeyFieldName,
TEXTLIST TEXTLISTReplaceFieldName,
TEXTLIST TEXTLISTTargetFieldName,
FNLIST FNLISTTargetFieldFlags,
FNLIST FNLISTOperationFlags,
TEXTLIST TEXTLISTDefaultFieldName and
TEXTLIST TEXTLISTDefaultValue
further the following PARAMETERS
TEXT TEXTRemoveFieldNamesFieldName and
TEXTLIST TEXTLISTRemoveFieldNames

For the corresponding lists the elements at the same position in the lists belong together.
The change is made in the documents (for each document individually) of the DB with the DBHANDLE TODBHANDLE2 according to the following logic:
1. In the field from the current document (expected data types:TEXT or TEXTLIST), with the field name taken from TEXTLIST TEXTLISTKeyFieldName , the key from TEXTLIST TEXTLISTActKey is searched for.

2. From the field in the current document (expected data types:TEXT or TEXTLIST), with the field name taken from TEXTLIST TEXTLISTReplaceFieldName is taken, the element at the same position at which the key was found in the field above is taken.

3. This TEXT (from step 2) is then written to a field whose name is taken from TEXTLIST TEXTLISTTargetFieldName and with the field flags from FNLIST FNLISTTargetFieldFlags, in the current document.

If the key is not found in step 1,
first (see FNLIST FNLISTOperationFlags) the current document is searched for a field whose name is taken from TEXTLIST TEXTLISTDefaultFieldName, is searched for.
If it is found (expected data types:TEXT or TEXTLIST), its content is used as the field value in step 3.
If it is not found, the value from TEXTLIST TEXTLISTDefaultValue is used as the field value in step 3.
(With FNLIST FNLISTOperationFlags can be restricted to one method here.)

After the document has been successfully processed for each element of corresponding lists, the fields listed as TEXT or TEXTLIST in the field named TEXT TEXTRemoveFieldNamesFieldName are deleted from the current document. After that, the fields specified in TEXTLIST TEXTLISTRemoveFieldNames are deleted from the current document.

If an error occurs in this logic, the document is not replicated into the DB with the DBHANDLE TODBHANDLE2 and Element 4 of the FNLIST FNLISTERROR7 is incremented by one. In the case of a replication conflict, the document in the DB with DBHANDLE TODBHANDLE2 is always Conflict-Looser.

A FNLIST is returned:

Element   Meaning
1   UpdateCount TODBHANDLE2
2   CreateCount TODBHANDLE2
3   DeleteCount TODBHANDLE2

FN4:

Bit   HEX   Meaning
01   0001   Lesen
02   0002   Schreiben
03   0004   Modify
04   0008   Delete

NOTECLASSES5:
DEC   BIT   Meaning

00000   XX   No Notes   no documents
00001   01   Documents   data documents
00002   02   Policy Note   About-database document
00004   03   Form Note   form design documents
00008   04   View Note   view design documents
00016   05   Icon Note   icon document
00032   06   Design Collection Note   view documents
00064   07   ACL Info Note   ACL info document
00128   08   Help-Index-Note   
00256   09   Help Note   help database document
00512   10   Filter Note   macro design documents
01024   11   Field Note   field design documents
02048   12   Replication Note   replication documents
04096   13   Private_Design   private design documents

32768   16   Default Note of Each   the default document of each

32767   01-15   Notes   all documents
32766   02-15   All Non-Document Notes   all non-data documents

(To specify multiple document classes, add the values of the relevant classes or build them using @BitVektor )

FNREPLICATIONFLAGS6:

Bit   HEX   Meaning
01   0001   Localize links (Doc; View; DB) in databases with different replica IDs.

FNLISTERROR7:
When the optional return parameter FNLISTERROR7, is used, error statistics are returned in it.

Element   Meaning
1   Error UpdateCount TODBHANDLE2
2   Error CreateCount TODBHANDLE2
3   Error DeleteCount TODBHANDLE2
4   Error Replacer TODBHANDLE2

FNLISTOperationFlags:
DEC   BIT   Meaning

00001   01   Use only DefaultText *
00002   02   Use only DefaultField *

* If none of this bits is set: Use DefaultField if possible otherwise use DefaultText

FNLISTTargetFieldFlags:
DEC   BIT   Meaning
0001   01   SIGN
0002   02   SEAL
0004   03   SUMMARY
0008   04   
0016   05   SEALED
0032   06   READ/WRITE-ACCESS
0064   07   NAMES
0128   08   
0256   09   PLACEHOLDER
0512   10   PROTECTED
1024   11   READ-ACCESS

(To specify multiple field flags, add the values.)

Example: @PushAndReplace(FROMDBHANDLE1;TODBHANDLE2;FORMULA3;FN4;NOTECLASSES5;FNREPLICATIONFLAGS6;FNLISTERROR7;TEXTLISTActKey;TEXTLISTKeyFieldName;TEXTLISTReplaceFieldName;TEXTLISTTargetFieldName;FNLISTTargetFieldFlags;FNLISTOperationFlags;TEXTLISTDefaultFieldName;TEXTLISTDefaultValue;TEXTRemoveFieldNamesFieldName;TEXTLISTRemoveFieldNames)

FROMDBHANDLE1:=@OpenDB("REPL1.NSF");
TODBHANDLE2:=@OpenDB("REPL2.NSF");
FORMULA3:="SELECT @All";
FN4:=@BitVektor(1:2:3:4);
NOTECLASSES5:=1;
FNREPLICATIONFLAGS6:=1;
TEXTLISTActKey:="Key1":"Key3";
TEXTLISTKeyFieldName:="KeyList":"KeyList";
TEXTLISTReplaceFieldName:=ReplaceList":"ReplaceList";
TEXTLISTTargetFieldName:="Target1":"Target2";
FNLISTTargetFieldFlags:=1092:100;
FNLISTOperationFlags:=0:0;
TEXTLISTDefaultFieldName:="DefaultFieldName1":"DefaultFieldName2";
TEXTLISTDefaultValue:="DefaultValue Key1":"DefaultValue Key2";
TEXTRemoveFieldNamesFieldName:="RemoveFieldsList";
TEXTLISTRemoveFieldNames:="";
Ret:=@PushAndReplace(FROMDBHANDLE1;TODBHANDLE2;FORMULA3;FN4;NOTECLASSES5;FNREPLICATIONFLAGS6;FNLISTERROR7;TEXTLISTActKey;TEXTLISTKeyFieldName;TEXTLISTReplaceFieldName;TEXTLISTTargetFieldName;FNLISTTargetFieldFlags;FNLISTOperationFlags;TEXTLISTDefaultFieldName;TEXTLISTDefaultValue;TEXTRemoveFieldNamesFieldName;TEXTLISTRemoveFieldNames);
@LogReport(Ret;3);
@LogReport(FNLISTERROR7;3);

TODBHANDLE2:=@CloseDB(TODBHANDLE2);
FROMDBHANDLE1:=@CloseDB(FROMDBHANDLE1);

The documents from the DB with the DBHANDLE FROMDBHANDLE1 are replicated into the DB with the DBHANDLE TODBHANDLE2 and modified.

1. Example of a document and its modification:

Document in DB1:
Field name   Data type   Field flags   Content (list separator semicolon)
KeyList   TEXTLIST   4   Key1;Key2;Key3
ReplaceList   TEXTLIST   4   User1;User2;User3
RemoveFieldsList   TEXTLIST   4   KeyList;ReplaceList;RemoveFieldsList
Form   TEXT   4   Test

replicated (and modified) document in DB2:

Field name   Data type   Field flags   Content (list separator semicolon)
Target1   TEXT   1092   User1
Target2   TEXT   100   User3
Form   TEXT   4   Test

2. Example of a document and its modification:

Document in DB1:
Field name   Data type   Field flags   Content (list separator semicolon)
KeyList   TEXTLIST   4   Key2;Key3;Key4
ReplaceList   TEXTLIST   4   User2;User3;User4
DefaultFieldName1   TEXT   4   DefaultUser1
RemoveFieldsList   TEXTLIST   4   KeyList;ReplaceList;RemoveFieldsList;DefaultFieldName1
Form   TEXT   4   Test

replicated (and modified) document in DB2:

Field name   Data type   Field flags   Content (list separator semicolon)
Target1   TEXT   1092   DefaultUser1
Target2   TEXT   100   User3
Form   TEXT   4   Test

3. Example of a document and its modification:

Document in DB1:
Field name   Data type   Field flags   Content (list separator semicolon)
KeyList   TEXTLIST   4   Key2;Key3;Key4
ReplaceList   TEXTLIST   4   User2;User3;User4
RemoveFieldsList   TEXTLIST   4   KeyList;ReplaceList;RemoveFieldsList
Form   TEXT   4   Test

replicated (and modified) document in DB2:

Field name   Data type   Field flags   Content (list separator semicolon)
Target1   TEXT   1092   DefaultValue Key1
Target2   TEXT   100   User3
Form   TEXT   4   Test

Note on these example documents:
Fields that are not required to understand the replace logic ($UpdatedBy, $Revisions, etc.) are not listed.

Note : This text was machine-translated and may contain inaccuracies.