dynamic constraint in database replication module

1
Hi, The database replication module allows one to add a constraint to limit the list of objects to replicate. This is a free format text field, but the constraint that I would like to use changes over time. The source database has a mutation date, similar to changeOn in Mendix, where I would like to sync only those objects that have a recente mutation date. How do I implement my dynamic custom constraint? Regards, Paul
asked
1 answers
1
  1. Create an entity (e.g. lastSync) that is associated to TableMapping. (DatabaseReplication)
  2. If the lastSync date is filled, clear the SQLConstraint of TableMapping (be sure not to erase your own extra constraints)
  3. Add to sqlConstraint: "(mutationDate >" + lastSync.datetimefield + ")" (Choose necessary date-time and other formatting). Be careful, this is directly copied into the SQL command, any typo will disable the replication.
  4. Set TableMapping.UseCustomsContraints true
  5. Perform Replication
  6. Store the last sync time and date in lastSync if successful.
answered