Custom compare using external conversion

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Stumpii
    Enthusiast
    • Apr 2008
    • 49

    Custom compare using external conversion

    I want to write a plugin to convert CSV files a certain way before they are compared. The output needs to be based on data in both of the original files, not just a conversion of file 1 then a conversion of file 2.

    For example file 1 may have a header and file 2 may not have a header. If either file does not have the header, then I want to strip it out if both. If both have a header, then I can leave it alone. This is a simple example of other things I want to be able to do.

    Are there any secret variables other than %s and %t that can be used?

    I have thought about checking for existing %t files in the temp folder to determine if this is the first or second comparison and storing the first conversion file name in the registry/ini file to be picked up by the second check, but this is a very messy and slow way to do it.

    Any suggestions would be appreciated.
  • Chris
    Team Scooter
    • Oct 2007
    • 5538

    #2
    Re: Custom compare using external conversion

    In addition to the information in the help file, there is also a knowledge base article with information about external conversion.

    http://www.scootersoftware.com/suppo...conversion.php

    The current external conversion support doesn't provide access to both the left and right files at once. Conversion for each file is a standalone process.

    There aren't any variables that will allow you to determine the name of the right side file while the left is being converted, or the other way around.
    Chris K Scooter Software

    Comment

    • Stumpii
      Enthusiast
      • Apr 2008
      • 49

      #3
      Re: Custom compare using external conversion

      As I thought.

      Can you tell me if the BC comparison is started when both files have been converted, or if the first file is converted and read in by BC then the second file is converted and read in by BC?

      If both are read in once both conversions are complete, I can try regenerating both files while the second file is being parsed.

      Comment

      • Chris
        Team Scooter
        • Oct 2007
        • 5538

        #4
        Re: Custom compare using external conversion

        I think the conversion happens in parallel, so it isn't likely to work to try to change both files.
        Chris K Scooter Software

        Comment

        • Stumpii
          Enthusiast
          • Apr 2008
          • 49

          #5
          Re: Custom compare using external conversion

          Is it possible to add this feature into a future version of BC2? Will BC3 allow more control over the conversion process?

          Comment

          • Chris
            Team Scooter
            • Oct 2007
            • 5538

            #6
            Re: Custom compare using external conversion

            The conversion process in BC2 isn't likely to change.

            In our current in house version of BC3, the conversion process is pretty similar to conversion in BC2. It is possible this might change before BC3 is released.
            Chris K Scooter Software

            Comment

            • dr_barnowl
              Expert
              • Apr 2008
              • 71

              #7
              Re: Custom compare using external conversion

              Suggested ways of doing this :

              If BC2 does the conversion serially (waits for an exit code from the first conversion before starting the second), write a routine that stores the session information on the first call and uses it on the second.

              If BC does the conversions in parallel, make the converter a server that waits for two calls from a client program before converting. You may have a small issue determining which is left and which is right (you didn't say if your conversion cares as I recall). I'd assume that BC spawns the process for "left" first though.

              eg -

              Write the converter as an ActiveX server. Write the converter client as a program that passes it's parameters to that server, and returns when it receives an event from that server.

              BC calls the client program for each file. The first client creates a server instance and passes parameters to it. The second client finds the server instance and passes parameters to it. The server returns an event to each client when it finishes processing, and then terminates. The clients return, BC knows they are finished, it compares the temp files, everything is done.

              Code:
              BC  ---[Client %params1]----|                |   - %file1
                   |                      | ActiveX Server |---| convert
                   --[Client %params2]----|                |   - %file2

              Comment

              Working...