Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Beyond Compare to compare data files matching columns by name, not by order

I have two scenarios:

  1. Two csv files with the same number of columns, but the column order differs. The first row of the csv is a header row and indicates correctly the column names
  2. Two csv files with some different columns, but actually most columns are present in both files. Again, the csv header row indicates column names that could be compared

In both of the above scenarios, BC3 fails to automatically match/change the column order automatically. This can be done manually via the Session Settings menu, but is rather time consuming.

An Example of #2 from above

Note in the following screenshots, that the left file has a column called priority which the right file does not have.

Before (default with columns matched by order):

Note that in the image below, that the left file's column 5 priority is being compared with the right file's column 5 companyjob. All of the following column comparisons are similarly mismatched.

Before

After (With columns manually matched by name):

After

Is there an easy way to easily/automatically configure this compare as I've manually done in the second image?

like image 318
Joshua Berry Avatar asked Oct 03 '12 16:10

Joshua Berry


1 Answers

It appears to me that you can save a comparison session in Beyond Compare (simply referred to as sessions), which is an actual diff between two file system objects. Those settings you're altering above are specific to that session, but you'd like them to be applicable to any other similar session. I wonder if a workaround could be to save the session with your manually entered Data Compare Column Settings and alter the paths of similarly formatted files to make them adopt the same column settings. Let me see...

Consider three files

file1.csv

Column1,Column2,Column3
A,B,C
A,B,C
A,B,C1

file2.csv

Column1,Column3,Column2
A,C,B
A,C,B
A,C1,B

file3.csv

Column1,Column3,Column2
A,C0,B
A,C,B
A,C,B

Here's the default diff between files 1 and 2The default data session between file1.csv and file2.csv

And here I alter the Data Compare Column SettingsMoving Column 3 up a level in Right file Which now shows no change between these two files with permuted columns.enter image description here

With that session saved I then edit the address bar to replace file2.csv with the similarly formatted file3.csv and wait to see if the column settings are maintained, looks to me like they areenter image description here

So I suppose you could persist those column settings in an arbitrary example session where you'll later have to change the paths to the actual files you wish to be diffed at that point in time. A little awkward for sure, it would be much nicer to have those settings apply as a preconfigured setting much like how in a Folder Compare session you can save Filter settings to be applied to new sessions.

I am curious however why your dialogs look different from where I navigate to edit the settings; in particular yours displays a pull down that reads "Use for this view only". What else is listed in that pull down? I'm using version 3.3.8 (build 16340)

like image 111
jxramos Avatar answered Sep 28 '22 10:09

jxramos