Data Compare
The Data Compare function of Data Sync allows you to preview the differences between your source and target data sets.
It can be found in the shortcut toolbar of Data Sync.
To use this feature you need to have added the columns you want to synchronise to your schema map and have selected a key column that is unique and can be used to identify each record.
Then click the Compare button (or F5), the source and target data will be loaded and data sync runs a comparison to work out Add, Update and Delete actions to make the target the same as the source.
By default Delete is always disabled, you can enable and disable these action using the Connection Properties EnableAdd
, EnableUpdate
, EnableDelete
.
If an action is disabled the compare results will still show it in the results, however where an action is disabled the sync check box will be cleared.
This is a double opt-in check, for example if EnableDelete is set to False
and you check a row in the results for delete, the row will not be deleted unless EnableDelete is set True
.
Compare Results
The Compare Results window shows a summary of the results, from here you can view the proposed changes, choose what to sync and export the results.
Selecting one of the change sets (Add/Update/Delete) from the results allows you to view the actual data in this change set.
By default all the changes are included, however you can uncheck the sync check box against any changes you do not want to make. You can do this one row at a time or from the mini-toolbar to check all, clear all or toggle the selected rows.
Update Results
Where you have UPDATE actions, Data Sync will highlight the target columns with a yellow background to show that these are to be updated. Since Data Sync compares the Data column by column only the changed/highlighted data is sent to the target.
Synchronise Changes
To apply the changes in the compare results tab, press the Synchronise button in the compare toolbar.
This will then display the Synchronise window, and clicking Start will begin the Synchronisation process.
Export Results
You can export the compare results to either a Excel Spreadsheet or an Xml .NET DataSet format file via the Export buttons in the toolbar.
Simply select the button and define the file name and location it should be created, Data Sync will then create the export file for you in the chosen format.
Data Compare Settings
The Data Compare Settings in Data Sync allow you to control how the data is compared. You can change this on a column-by-column basis in the Schema Map.
The Data Compare Mode controls how the values in the source and target are compared for UPDATE actions. By default, Data Sync compares if the values from each side are equal.
There are different modes available to suit different scenarios:
- TargetNotEqual: This is the default mode where a change is detected when the values are not equal.
- TargetEqual: A change is detected when the values are equal.
- TargetLessThan: A change is detected when the target value is less than the source. This is typically used in 2-way sync scenarios to prevent updates to a row when the modified date is greater on the target.
- TargetGreaterThan: A change is detected when the target value is greater than the source.
- TargetIsNullOrEmpty: A change is detected when the target value is null or empty and the source has a value.
- SourceIsNotNullOrEmpty: A change is detected when the source has a value and the target is not equal to the source.
You can find the Data Compare Mode options in the image below:
The Data Compare Mode is typically used in conjunction with the Trigger Update setting, which controls what change(s) will cause an UPDATE action to be created.
For example, in a 2-way sync scenario where you have a modified DateTime value on each side which is updated when the row is changed, you would create two projects running in different directions.
In the first project, you would set TriggerUpdate=False on all columns in the Schema Map except for the Modified column, and then set the Mode=TargetLessThan for the Modified Column. This ensures that Data Sync only compares the values on this row when the target Modified value is less than the source, i.e., the source is more recent.
In the second project, you can set up the project as normal but in reverse. You then set the projects to run after each other in Ouvvi or the Run Tool.
The Ignore setting prevents Data Sync from comparing the value and generating an UPDATE action for this column. However, if any other column causes an UPDATE action, the value of this column will be added to the change set. This is useful when you want to force a column's value to always be sent to the target. The ignore setting will prevent Data Sync comparing the value and generating an UPDATE action for this column, however if any other column causes an UPDATE action then the value of this column will be added to the change set. This is useful when you want to force a columns value to always be sent to the target.