Text File Update

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




Search WWW

Search DelphiForFun.org

As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.


Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. 


We receive a few cents from each purchase.  Thanks


Support DFF - Donate

 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.

Mensa Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa 365 Puzzlers  Calendar 2017

Mensa 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)


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)
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 11 May 2018



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