Announcement

Collapse
No announcement yet.

Changing key column whole comparing csv in script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Changing key column whole comparing csv in script

    I am comparing 2 CSv in automation using java. Using below script file I invoke BC on linux machine and report is stored in S3 folder. But currently it takes default 1st column as key. I want to set differrent column as key runtime depending on test.
    Kindly guie me to that
    Also It will help if you can guide me on where to find BCSession.xml on linux machine.
    Script file contents are:
    file-report layout:Interleaved &
    options:display-mismatches &
    output-to:%3 output-options:html-color %1 %2

  • #2
    Hello,

    Your BCSession.xml depends a bit on your linux distro, but many would place it in your user's home directory\.config\bcompare\BCSessions.xml.

    Make a backup of the file. Then go to the graphical interface, in the saved Sessions list, expand the New folder, select Table Compare and click to Edit Defaults. In the Columns tab, select specific columns and set them as Key (default, Column 1 is already set to Key). Set what you need then Save the new defaults.

    Now use BC4 itself to compare the backup BCSessions.xml to the newly configured BCSessions.xml and you can see which nodes control the Default session settings and how they are updated.

    If you need to change settings on the fly, you would need to alter the .xml before calling to bcompare @script.txt. If you can configure it just once, you can set the default in the graphical interface, and script will then use that for the file-report command.
    Aaron P Scooter Software

    Comment


    • #3
      Originally posted by Aaron View Post
      Hello,

      Your BCSession.xml depends a bit on your linux distro, but many would place it in your user's home directory\.config\bcompare\BCSessions.xml.

      Make a backup of the file. Then go to the graphical interface, in the saved Sessions list, expand the New folder, select Table Compare and click to Edit Defaults. In the Columns tab, select specific columns and set them as Key (default, Column 1 is already set to Key). Set what you need then Save the new defaults.

      Now use BC4 itself to compare the backup BCSessions.xml to the newly configured BCSessions.xml and you can see which nodes control the Default session settings and how they are updated.

      If you need to change settings on the fly, you would need to alter the .xml before calling to bcompare @script.txt. If you can configure it just once, you can set the default in the graphical interface, and script will then use that for the file-report command.
      This is workign as expected. Thanks so much!!

      Comment


      • #4
        Hi Aaron
        Is it possible to get return code where I run script from CLI and based on return code I can decide fruther action in my java code?

        Comment


        • #5
          Not from the script (other than if the script was successful). Script can perform many sequential actions, such as several reports in a row, so a single return code doesn't represent a single report command within the script.

          You can use /quickcompare (/qc) which takes two input files and does have a return code for if the files are equal, similar, etc. We have a full list of any return codes in the Help file, Command Line Reference, near the bottom. For a /qc, the more applicable ones would be:
          1 Binary same
          2 Rules-based same
          11 Binary differences
          12 Similar
          13 Rules-based differences
          100 Unknown error
          Aaron P Scooter Software

          Comment


          • #6
            Aaron The BCSessions.xml file is being used to set key column but in the result HTML, I still see first column which have marked as unimportnat is highlighted in Red. It should be blue? Is taht because values in teh same row but other columns also have diff? This gives an impression that first column is not being marked as unimportant. Content of my BCSession.xml are:
            <?xml version="1.0" encoding="UTF-8"?>
            <!-- Produced by Beyond Compare 4 from Scooter Software -->
            <BCSessions Version="1" MinVersion="1">
            <TSessionFolder>
            <Items>
            <TDataCompareSession>
            <Rules>
            <Cols>
            <Keys Value="4"/>
            <Custom>
            <_0>
            <Num Value="1"/>
            <Insig Value="True"/>
            </_0>
            </Custom>
            </Cols>
            </Rules>
            </TDataCompareSession>
            </Items>
            </TSessionFolder>
            </BCSessions>

            Comment


            • #7
              With that snippet, it looks like the Insig value for column 1 is Unimportant, and the Key is column 4. For your automation, I suggest initially testing from the Windows Command Prompt. First, type "c:\program files\beyond compare 4\bcompare.exe" and load the interface, making the adjustments and testing. Then from the same prompt, load bcompare.exe @script.txt and run the automation. This helps make sure the same windows user account and same settings are used for the interface and the automation testing. If this works, and the other automation differs, it is then down to troubleshooting the automation process and the user that is running it (or switching to a Portable Install).
              Aaron P Scooter Software

              Comment

              Working...
              X