Go Back   Scooter Forums > Beyond Compare 2 Discussion > Script Central
Register FAQ Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1  
Old 08-Jun-2012, 04:22 PM
glennb glennb is offline
New User
 
Join Date: Jun 2012
Posts: 2
Default Data Compare plus scripting

I’ve been using the Data Compare session type for a while now, and loving the way BC automatically parses my delimited files and allows me to easily define key columns and mark others as unimportant. Now I’m ready to automate some of my comparisons using the scripting language. Unfortunately it appears that BC doesn’t support loading Data Compare sessions (with predefined key and unimportant definitions) from within a script.

I’ve been researching alternatives, and stumbled across the “regular expressions” capability. Would it be possible for me to use regular expressions to specify unimportant columns by saying something like “the fields after the 5th and 11th tab characters are unimportant”? Or is there some easier way to do this I’m missing?

Thanks
Reply With Quote
  #2  
Old 11-Jun-2012, 08:58 AM
Aaron Aaron is offline
Team Scooter
 
Join Date: Oct 2007
Location: Madison, WI
Posts: 5,432
Default

Hello,

Unfortunately, our Regular Expressions are not conditional, and we don't have a way to "count" up to the 5th tab without also including the previous tabs. We don't have a way to find just the text after the 5th tab and after the 11th tab.

If the entire middle was unimportant, you could define the "beginning of line to the 1st tab, text, 2nd tab, text, etc, to the 5rd tab" as Important, and "text, tab, text, tab, text, end of line", then that could potentially work. Here is an example KB article with video:
http://www.scootersoftware.com/suppo..._unimportantv3



Are you attempting to generate a Data Compare Report, or something along those lines, with script?

The method to load a Data Compare in script is a bit complicated in BC3, but doable. You create a parent Folder Compare session with saved child settings for your Data files. You can do so by configuring it in the graphical interface.

First, you would create a Folder Compare session that points to your two files, aligned side by side. Do your two files reside in two different folders and have the same name? If so, you can simply set these two folders as your base folders. If your files have different names, or are in the same folder, this gets a little trickier. Do you have BC3 Pro or Std?

Assuming we have a saved Folder Compare session with your two files aligned, you can set the file name filter to show only that pair of files. Next, double click on the files and launch a child Data Compare session comparing those two files. Configure this session's Session Settings, and at the bottom of the Session Setting dialog is a dropdown that says "Use for this view only". Change this to "Use for all files in parent session" (or "Use for these files in parent session"). Close the child Data Compare tab and re-save your parent Folder Compare.

You can now use this Folder Compare in scripting. The script would perform something like this:
load parentSession
expand all
select all.files
data-report layout:side-by-side output-to:"c:\bcreport.txt"
__________________
Aaron P Scooter Software
Reply With Quote
  #3  
Old 13-Jun-2012, 02:12 PM
glennb glennb is offline
New User
 
Join Date: Jun 2012
Posts: 2
Default

Thanks, Aaron.

Yes, I'm attempting to generate something like the Data Compare report from a script. And I need to instruct it to ignore certain columns.

I have BC3 Std, but I would consider upgrading if it made this task easier.

Glenn
Reply With Quote
  #4  
Old 14-Jun-2012, 08:37 AM
Aaron Aaron is offline
Team Scooter
 
Join Date: Oct 2007
Location: Madison, WI
Posts: 5,432
Default

Thanks for the offer, but I cannot think of any BC3 Pro features that would help with this workflow.

I would suggest starting out in the graphical interface with the saved Folder Compare session, with the saved child session settings for the Data Compare. When you double click on the data files in the saved Folder Compare, if it pops up with the proper defaults (saved as part of the parent), then the script will respect these changes, too.

I assumed this earlier, but your files/sessions all need to be uniquely configured, correct? If not, you could update the Data Compare's default session settings, and the script would use that without the previous setup or need to open a Folder Compare first. If you are comfortable editing XML, you could also create an automated solution with edits the BCSessions.xml, altering the "default" Data Compare session settings, then calls your BCScript. I'm not sure if this would be an easier solution than the saved Folder Compare, however.
__________________
Aaron P Scooter Software
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -6. The time now is 02:50 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.