How to declare fixed width values in a data compare from a script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sgalante
    Visitor
    • Jun 2017
    • 3

    How to declare fixed width values in a data compare from a script

    I am trying to create a script that will allow a user to compare two files with a pre-set fixed width setting. There are 1727 columns with 9 different columns used as a key. This works without issue when done right in Beyond Compare 3 but if any other data compare is used the fixed width settings get wiped and a <default> comma delimited setting is set in place. The only way I can get the fixed width back in is to manually go in and change the settings. The issue I have is I need to also setup a scrip to compare CSV files separately so a user will end up using both. Is there a way to re-apply the fixed width settings before a compare and also define a comma delimiter during the CSV compares?

    I have tried saving a test compare as a session and as a workspace but whenever I load the CSV session it auto changes the fixed width sessions settings in that separate session as well as the workspace.
  • Aaron
    Team Scooter
    • Oct 2007
    • 15997

    #2
    Hello,

    Each File Format (Tools menu) should control if the file is Fixed Width or Delimited. We already have a CSV Format defined, with "," as the delimited, so leave this format with default values to open your *.csv files. For your Fixed Width files, what file extension do they use? You can create a new "Data format" in the Tools menu -> File Formats dialog for that extension, and it would be used automatically when opening matching files. If the files have very specific names, the extension mask can be extended to match on a more full file name.
    Aaron P Scooter Software

    Comment

    • sgalante
      Visitor
      • Jun 2017
      • 3

      #3
      Aaron,

      I was able to follow your recommendation and get the format to work as needed, now is there a way to script the compare as a data compare with the key rules and set ignores in place based on a session or something else? I need to be able to mass compare 10-300 pairs of files based on the same set of rules. I have a script that will compare text files and output an HTML report based on differences but I am having issues getting the data compare keys (I am using 11 different columns) and ignore rules to apply when scripted.

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 15997

        #4
        Unfortunately, we do not have a good method of overriding the Keys for individual file pairs from the command line. It's something on our wishlist. There are a couple of methods to help handle this:

        1) Externally update the BCSessions.xml to new defaults before calling the script.

        2) Use child session settings as part of a main Folder Compare session. If your file set can be a pair of aligned files in the Folder Compare (so that a rules-based scan would scan each pair as you need), then you can double click into any pair, launching a child Table Compare session. This session can be updated with new keys in the Session Settings, and next to the OK button is a drop down: change from Use only for this view to Also update for these/all files in parent session. Re-saving the parent folder compare, and then loading that folder compare session in script, would use the updated child settings.
        Aaron P Scooter Software

        Comment

        • sgalante
          Visitor
          • Jun 2017
          • 3

          #5
          Okay if I go this route:
          Originally posted by Aaron
          2) Use child session settings as part of a main Folder Compare session. If your file set can be a pair of aligned files in the Folder Compare (so that a rules-based scan would scan each pair as you need), then you can double click into any pair, launching a child Table Compare session. This session can be updated with new keys in the Session Settings, and next to the OK button is a drop down: change from Use only for this view to Also update for these/all files in parent session. Re-saving the parent folder compare, and then loading that folder compare session in script, would use the updated child settings.
          How do I set a child session to use data compare and since file names will differ slightly (based on origin) will I need to manually select the pair to start the child data compare? Once that is configured, are you saying I will be able to then script the call to the folder compare and that will auto trigger the file level data compare?

          Comment

          • Aaron
            Team Scooter
            • Oct 2007
            • 15997

            #6
            If the names are not aligned in the Folder Compare, that would be tricky. You would also need to configure the Folder Compare session to align them with the Align With command and save that as part of the parent Folder Compare. Are they differently named in the same way (logical rule)? If so, you could define an Alignment Override to align all file pairs that differ with that rule if you have BC4 Pro (Session Settings, Misc tab). If you are registered for Std, you can trial Pro without purchase:
            http://www.scootersoftware.com/suppo...?zz=kb_evalpro
            Aaron P Scooter Software

            Comment

            Working...