Text File Update

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math Topics]   [Library]   [Utilities]

 

Search

 

Search DelphiForFun.org only

Support DFF

 If you shop at Amazon anyway,  consider using this link. We receive a few cents from each purchase.   Thanks.

In Association with Amazon.com

 

Support DFF

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

 

 

Contact

Feedback:  Send an e-mail with your comments about this program (or anything else).

 

Search DelphiForFun.org only

 

 

 

 

File Update is does text match-merge processing of a file of Update transactions against a Master file. 

Each DFF newsletter that goes out results in 50 or so undeliverable.   There is no automatic mechanism to remove these invalid email addresses from the subscriber list, so I spend an hour or two manually updating the list each time.    I recently decided to automate this process.   The final product will scan reject emails and extract the addresses to delete, but in Phase 1, this program,  I drag the email addresses to a text file which the program sorts and passes against the subscriber list to delete matching records. 

I've generalized the program to optionally add records which do not exist.

Note that the match "key" is the entire record which probably restricts the [program's usage to simple list of names or objects.  

There are a surprising number of decisions to make when matching two files.  Here are the options that  ended up as radio button boxes in the program:

bulletAction to take when update record matches master record
bulletDelete master record (default)
bulletIgnore       
bulletAction to take when an update record does not match aster record
bulletAdd transaction to a master record
bulletIgnore the transaction  (default)
bulletIf duplicate records are found in Master file:
bulletLeave them in Master
bulletDelete duplicates (default)
bulletIf duplicate update transactions are found: (If previous option is "Delete Duplicates", then this box will be hidden and duplicate update transactions  will be ignored.) 
bulletProcess the transaction according to option below
bulletIgnore duplicate update transactions (default)
bulletHow to match: (If previous option is set to "Ignore duplicate updates", this box will be hidden and each transaction will delete all matching master records.)  
bulletDelete at most one master record 
bulletOne update transaction will delete all matching master records (default)

Additional options control:

bulletWhether upper and lower case is ignored when comparing (i.e. albert=Albert).
bulletAn option allows leading and trailing blanks to be deleted before comparison.  

Note for programmers:

There's a new experimental TSyncMemo class implemented here to synchronize the three TMemos used to display Master record, Update transactions, and Action taken.   An arbitrary number of TMemos can be associated with a TSyncMemo.   Only vertical scrolling is synchronized.   It's not perfect, the "slave" TMemos can be scrolled independently even though no vertical scroll bars are specified, but it was quite simple to implement and works well enough for now.  An enhanced version may show in Delphi Techniques one of these days

Files are loaded into TStringlists which are sorted using CustomSort to handle user  case sensitivity option.

Download Programs

The program has not been extensively tested and is presented "as is" for your testing or modification.   Always save output to a new file until you have verified its correctness.  

Download source

Download executable

                                        

Created 11 April  2005  

Modified 07 Nov 2008

 

              

  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright 2000-2013, Gary Darby    All rights reserved.