Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Import Class Ideas?
Message
 
To
27/03/1998 10:18:16
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00087665
Message ID:
00087706
Views:
37
>>I am working on an import class. What this class will do is:
>>
>>(1) allow the user to select an import type
>>(2) allow the user to select a file from that import type
>>(2) from that import type create some temporary tables and structures unique to that import type
>>(3) append the import file into the newly created temporary tables
>>(4) do some file processing unique to that import type
>>
>>
>>I'm running into design problems trying to make a generic class that can handle any import type and unique file processing for that type. How I had it set up originally is have a table with an import type field, a structure memo field (in which I have a list of table structures and names for that type), and a process memo field (in which I place the custom processing code for that import type.
>>
>>I'm having all sorts of problems with macro substituting structural arrays for the creating of tables and the same for processing routines. I really didn't want to hard code this information for each new import type we get.
>>
>>Perhaps my whole approach is wrong? Anyone have any ideas on a better approach to this type of class? Any input/discussion would be much appreciated...hey, I know you all like theoretical discussions ;).
>
>I wrote similar import class for one project and after some testing I ended up with 3 basic import choices: fixed length text file, delimited text file (with flexible delimiter/separator character), table with fixed structure. System accepts input from various sources, most of them structured ASCII files (choice 1 or 2), but some files are really difficult to be imported immediately (e.g. prn files). These files preparated manually by myself into table with fixed structure and then processed by the class (choice 3).


The problem I see with that type of implimentation is the hard-coding of structures and such. Any time you would need to add a new import type you will need to modify your class and redistribute the executable. I am trying to develop something generic enough so that you can specify everything you need in a table.

I haven't been able to get the create table command to work with macro substition, e.g. Create table import1 (&v_import.struct). It has all sorts of problems. But, at least that looks doable in some form if I work out all the bugs. My biggest problem is coming up with a generic way to deal with file processing related to each import. If I have stright commands I need to do (for example REPLACE ALL v_import.name with UPPER(v_import.name) then I might be able to place this code in a memo field and macro substitute it. However, if I need any type of looping, do...while, for...endfor, etc., I can't use macro substitution.

This whole class is becoming a lot more complicated than I expected :).

Michael G. Emmons
memmons@nc.rr.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform