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

1

6

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?

Mcgriff answered 3/10, 2012 at 16:17 Comment(0)
A
1

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)

Artis answered 17/12, 2014 at 1:27 Comment(1)
Thanks @Artis for the suggestions. I don't see an option in BC3 to save a given profile to anything other than the default which would be applied to all future data compares. Also note that in your example the column header row is being considered another data row to be compared. Ideally, the tool could use the header row names to generate session settings that would compare columns with the same name. Regarding the difference in dialogs: I'm now using BC 3.3.13 (build 18981) which is licensed as the Pro Edition for Windows. What I posted with an earlier version is still how it appears.Mcgriff

© 2022 - 2024 — McMap. All rights reserved.