ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL / HFSQL functions
  • Example: Synchronizing the replicas by using a filter procedure
HSynchronizeReplica (Example)
Example: Synchronizing the replicas by using a filter procedure
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)AjaxHFSQL ClassicHyper File 5.5 The following example uses a WLanguage procedure during the replication. This FilterReplica procedure is used to filter the records that must be taken into account during the replication and to manage the replication conflicts.
IF HSynchronizeReplica("C:\Data", "D:\Temp", rplToSubscriber, FilterReplica) = True THEN
Info("Replication performed")
END
PROCEDURE FilterReplica()
ProgressBar(RPL.OperationNum, RPL.OperationMax)
// ******************************** Filter records ********************************
// Example: Exporting the catalog of bargains
IF RPL.Direction = rplToSubscriber AND RPL.Operation = rplHAdd THEN
 IF RPL.File = "Product" AND {RPL.SourceAlias + ".BARGAINS"} = False THEN
  // The record must not be copied
  RESULT False
END
END
// ************************************** Management of conflicts ***********************************
// Example: Checks whether the product already exists
// HReadSeek(PRODUCT, ProductCode, {RPL.SourceAlias + ".ProductCode"})
// IF HFound() THEN
// // The record must not be copied
// RESULT False
// END
// No problem was detected
RETURN True
Minimum version required
  • Version 9
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help