Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Know of an Import/Mapper utility
Message
From
30/09/2003 11:16:05
 
 
To
30/09/2003 09:39:17
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00833445
Message ID:
00833503
Views:
23
Hi Steve.

I am looking for a utility program of sorts. I would like to be able to take a source table in various formats (excel, lotus, etc...) and import data into an established foxpro table. Allowing for some field mapping and manipulation in between.

If you have a copy of MegaFox: 1002 Things You Wanted to Know About Extending VFP, chapter 2 is entirely devoted to data driving your applications. We have an example of data-driving a migration and this code can be adapted very easily to do what you want.

How do I data drive a migration?(Example:Migrate.prg and FieldMap.dbf)
The need to migrate data from one structure to another is common when business requirements change and data structures no longer support the business model. Such a process is ‘one-off’ because, eventually, the migration of data to the new structure will be complete and the migration process will never be required again. Confronted with this situation it is very tempting to write a “quick and dirty” program, that hard-codes all of the steps required to convert the data. This is a bad move!

Anyone who has ever written a migration program can attest to the fact that it is invariably an iterative process. After careful examination of the old data, the first attempt is made to migrate this data into the new structure. When the results are reviewed by knowledgeable end-users (they are the data owners after all), it is certain that new information will begin to surface. If you hard code everything from the start, phrases like “Oh, I forgot to tell you that the xyz field contains customer balances unless the data was entered on a rainy Tuesday, in which case it contains a credit memo” will haunt your dreams. The process of refining the migration during this iterative process is much easier when the process is data driven. The objective is to change data in a table rather than code.

The key to data driving a migration is the construction of a “field map” that contains the rules for moving the legacy data into the data structures for the new system. It typically has a structure similar to the one listed in table 2.4 below.

Also, if you were at either DevCon 2001 or GLGDW 2001, I gave a session called "I Never Met a Data I Didn't Like" that has sample code that does both migrations and import/export in a data driven fashion.
Previous
Reply
Map
View

Click here to load this message in the networking platform