How to generate a Data Comparison report using script?

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

    How to generate a Data Comparison report using script?

    Dear all,

    Is it possible to automate the generation of a Data Comparison report from a pre-defined Data Comparison File Session? I tried to use the "load" command to load a pre-defined Data Comparison File Session but BC does not allow it.

    I was able to generate a Data Comparison report for two CSV files using the following script. But I would like the comparison to be done basing on the rules I defined in a Data Comparison Session. Any ideas?

    BC Script:
    option stop-on-error
    data-report layout:summary &
    options:ignore-unimportant,display-mismatches &
    output-to:%3 %1 %2


    Command Line:
    bcompare.exe @TestScript.txt H2\V00006.CSV H3\V00006.CSV V00006.txt

    Cheers,
    Tracy
  • Aaron
    Team Scooter
    • Oct 2007
    • 16017

    #2
    Hello Tracy,

    This could be done similarly by using a Folder Compare session, with a filter that shows only the file(s) you want.

    The easiest way to do this would be to use the graphical interface to create a Folder Compare session, then filter out all the files you do not want.
    Double-click the remaining csv, or csv files, and apply their session settings to the Parent Session for That Pair of files. Save the Folder Compare.

    Your script can then Load FolderCompareSessionName, expand all (if needed to see the files), select all, and then run the Data-Report command on the selection.
    Aaron P Scooter Software

    Comment

    • Meghana
      New User
      • Feb 2020
      • 2

      #3
      Hi ,

      I am using Beyond Compare version 4, 64 bit edition.

      With below Python code, I am able to open and compare the excel tables

      # Open Beyond Compare tool and compare the generated excel files
      check_output(""C:\Users\Beyond Compare 4\BCompare.exe" "+fileName1+"_new.xlsx "+fileName2+"_new.xlsx", shell=True)

      Please help me on how to generate html compare report for the same using python.

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 16017

        #4
        Hello,

        I would suggest testing this outside of python first, so you can verify the manual command line.

        The Windows command line would be:
        BCompare.exe "@c:\scripts\bcscript.txt" "c:\file1.xlsx" "c:\file2.xlsx" "c:\scripts\report.html"

        where bcscript.txt would contain the script to generate a report. This is documented in the Help file, Using Beyond Compare, Scripts chapter, and the Scripting Reference chapter. A sample could be something like:
        data-report layout:side-by-side output-to:"%3" output-options:html-color "%1" "%2"
        Aaron P Scooter Software

        Comment

        • Meghana
          New User
          • Feb 2020
          • 2

          #5
          Hello,

          Thanks for the response Aaron.
          As suggested, I created bcscript.txt accordingly and the compare report for the two tables under comparison is getting generated as well.

          But the problem now I am facing is,

          when i create a interleaved report manually from BC tool, it generates something like the attached.

          But the interleaved report generated from command line, its just two tables one after the other. I want to generate report like attached from command line . what changes to the below code should be done?

          # generate interleaved report in html file
          data-report layout:interleaved output-to:C:\Users\File-compare-python\report\compare-result-interleaved.html output-options:html-color


          Attached Files

          Comment

          • Aaron
            Team Scooter
            • Oct 2007
            • 16017

            #6
            Hello,

            When you use the interface to generate a report, are you loading a saved session with customized settings, either column ordering or alignment settings? You'll need to also update the session defaults to use this for new sessions (including script) from the Home screen, in the saved Sessions list, expand the New folder, select the Table Compare and Edit Defaults.
            Aaron P Scooter Software

            Comment

            Working...