PDA

View Full Version : Row based record comparisons


crossetj
09-Jan-2004, 04:21 PM
We use Beyond Compare for just about every step of the development process. It's our diff tool for WinCVS, new

Some of our files have a 'row based' data structure that seems to confuse Beyond Compares alignment algorithms. A 'row based' records is one where a delimited section marks each record and each line within that record represents a field. The files all have a structure like this:

Header Section
= START ================================

[A bunch of row based records]

= END ==================================
Footer Section

Each row based record looks like this:

= TABLE_NAME ---------------------------

KEY_FIELD1 = Value
KEY_FIELD2 = Value

FIELD_1 = Value
...
FIELD_N = Value

The header and footer sections are all 'unimportant text'. What I want (but expect isn't possible right now) is to be able to tell Beyond Compare to treat each record as a block. That is everything from one

= TABLE_NAME ---------------------

to the next should be treated as a signle unit for alignment purposes. Is there any advanced support for this in BC or am I going to have to write a viewer plugin that understands my file structure? I have some control over the format of the files, but the general structure is pretty much fixed.

Thanks,
Trevor

Craig
10-Jan-2004, 12:49 PM
BC alignment is purely line-by-line, and it doesn't support grouping lines into blocks. While that is something we're looking into, it will be quite a while before we have anything available.

One alternative you can try is using Line Weights to force alignments based on the key fields. The rules dialog is finally documented in the latest 2.1 release, and does cover line weights. Generally you'd want the weight to match on something like "KeyField=", and you'd give it a weight of 5000. It could still match added/deleted blocks up, but it should do a better job of aligning the blocks that are in both files.

pmason
12-Jan-2004, 04:08 AM
I also use key fields in records, but the data can change radically inside the record. I have used weighing of 5000 with limited affect. I usually have to resort to manual alignment which on a 30000 line text file can take a large amount of effort.
Having a “must match weight” would improve things immensely.

jdmarch
13-Jan-2004, 11:46 AM
Having a "must match weight" would improve things



Agreed, this would be helpful. Although it would only help for cases where there are no orphan lines on either side, right? So what about a tweak to the algorithm so that a specified delimiter must be matched, but it (and the text between 2 instances of it) can be missing. Sort of a crude multi-line record match.

Another option would be to use AWK to convert these multi-line records to single-line records for the purpose of comparision.