Merge Fields from a file into empty fields of a different file
This technote helps you update a database when you want to copy information from one database and add it to the existing records in another database. Follow the instructions below to complete this task.
- Open the file you want to merge from and the file you want to merge to.
- From the Edit menu, choose Command.
- Click on the New button.
- Type a name for the command in the Save As text box, such as Merge Fields.
- Copy and Paste or Type the following Five line command in the Command Statement Syntax box:
SET SAFETY OFF SELECT("DatabaseNameWithInfoInIt") INDEX ON UPPER(ALLT(matchkey)) TAG MatchkeyName SELECT("DatabaseNameThatNeedsInfo") REPLACE fieldname with DatabaseNameWithInfoInIt.fieldname for SEEK(UPPER(ALLT(matchkey)),"DatabaseNameWithInfoInIt")
- On Line2 of the command, type in the name of your database (without the extension) that contains the information that you'll be transferring to the other database.
- On Line3 of the command, type the words Index On UPPER(ALLT( and then type the name of the field that acts as the match key between the two databases, followed by two closed parentheses. After the word TAG, you can give a name to the matchkey, or just leave it as Matchkeyname.
- On Line4 of the command, type in the name of your database (without the extension) that you'll be merging into.
- On Line5 of the command, you'll type in the fields that will be involved in the merge. For instance, if you want to transfer the information from the Email field from Database B into Database A, this is what the fifth line will look like:
REPLACE email with DatabaseB.email for
* If you want to merge more than one field, you can do that as well on Line5:
REPLACE email with DatabaseB.email, company with DatabaseB.company, fax with DatabaseB.phone2 for
- On Line6, your matchkey followed by the database name will go inside of the parentheses. Make sure the database name is typed inside of the quotation marks, and leave the extension off the database name:
Run that command, and the task will be completed. If you'd like to do a merge perge with different databases or different fields, make a copy of the command and adjust the copy. Copying the command is as simple as changing the name of the command; when you change the name, the command is still saved under the previous title, so you'll be able to make changes to the copied command without changing the original.