Following the previous post "Command line data comparison - how does it work?", I would like to show how to create a report containing results of the data comparison.
The whole process is actually very simple. Command line client of SelectCompare offers you an easy way to export data to an Excel spreadsheet - the same format as the original version of SelectCompare creates.
When you run command sccmd help compare, the utility displays a list of options and parameters that you can use when you compare data.
When you scroll down a bit, you will notice options that control the behavior of the export.
--export-to-excel (Default: false) Export results to Excel
--excel-file-name Excel file name, if export option enabled. If this value is provided, it overrides automatic
report location and name.
--column-order (Default: AABB) Comparison results column order. Columns can be sorted by name (ABAB), or by
data source (AABB).
The switches are quite self-explanatory. In order to export data comparison results to Excel, you have to provide --export-to-excel switch. The report will be saved in the default folder. You can check the default location using command
sccmd configure --view-excel-folder
The location can also be changed using the following command:
sccmd configure --update-excel-folder <folder location>
sccmd configure --update-excel-folder c:\temp
The default location for data comparison exports is in your user profile folder: %USERPROFILE%\SelectCompare\Export.
If you change the export folder, there is an easy way to reset it to its default value:
sccmd configure --reset-excel-folder
This can be quite useful if you plan to write a batch to compare multiple data sets and you would like to separate the comparison reports in some way.
By default, SelectCompare names the data comparison export after the data comparison project name and appends current timestamp to the file name:
sccmd compare --project-id 1 --export-to-excel --column-order=ABAB
Comparing data for project [Employees vs Baseline]
Press Ctrl-C to cancel operation.
Completed: 100% - Done
Comparison finished in 0:00:01.69
Exporting data for project [Employees vs Baseline]
Exporting comparison results to [C:\Users\UserName\SelectCompare\Export\Employees vs Baseline_19-05-28_04-18.xlsx]
Completed: 100% - Done
Data export finished in 0:00:00.84
Comparison summary for [Employees vs Baseline]:
Equal rows: 4;
Different rows: 2;
Rows that exist only in Source data set: 1;
Rows that exist only in Target data set: 2;
Once the export is finished, you can open the file indicated in the output. The file contains comparison results, the high level summary and a chart that shows the proportions of the data differences in the selected data set.
I hope that this post will help you to understand the capabilities of the SelectCompare command line client. It can significantly speed up your work: once you define your projects and data sources, there is no need to launch the graphical interface of SelectCompare - you have all the data comparison and export functionality at your finger tips. Enjoy!