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
Create an entity (e.g. lastSync) that is associated to TableMapping. (DatabaseReplication)
If the lastSync date is filled, clear the SQLConstraint of TableMapping (be sure not to erase your own extra constraints)
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.
Set TableMapping.UseCustomsContraints true
Store the last sync time and date in lastSync if successful.