I have a problem that I am sure I am not the first to come across. My data is generated from Mumps into delimited text files. I cannot change that. I have over 100 tables with 50 variables in each. VFP9 can import text files with the import wizard but that will force me to repeat the process 100 times. My text files are delimted (TAB) and the field names are in the first line. I can get the fieldd names out of the text file in VFP, but cannot use the subsequent arrays to generate a tabel in SQL with the array values. Just trying to create a table with one array only does not work. Please see my little (simple I admit and probably not so elegant) program below.
My question - Is there any way to generate VFP tables from multitude of text files without first having to create tables by hand and then use the APPEND from function. With 100s of tables this becomes quite tedious and I would like to automate the process.
I'll appreciate any help!!!!! THANKS
Cobus
CODE snippet>>>>
My question - Is there any way to generate VFP tables from multitude of text files without first having to create tables by hand and then use the APPEND from function. With 100s of tables this becomes quite tedious and I would like to automate the process.
I'll appreciate any help!!!!! THANKS
Cobus
CODE snippet>>>>
Code:
LPARAMETERS cFileName
IF EMPTY(cFileName)
cFileName = GETFILE()
ENDIF
LOCAL aDataFile[1]
cFileData = FILETOSTR(cFileName)
nLinesToProcess = ALINES(aDataFile, cFileData)
STORE GETWORDCOUNT(aDataFile[1], CHR(9)) TO nFieldnames
*** create array
DIMENSION CFieldnames [nFieldnames]
*** First Field
STORE SUBSTR(aDataFile[1], 1, ATC(CHR(9),aDataFile[1])) TO cFieldnames[1]
*** Following Fields
FOR nTabs = 2 TO (nFieldnames - 1)
STORE STREXTRACT(aDataFile[1], CHR(9), CHR(9), ntabs-1 ) TO cFieldnames[nTabs]
ENDFOR
[COLOR=red]*** THIS iS WHERE IT GOES WRONG :-( even with just one array value
CREATE TABLE logs.dbf;
( cFieldnames[1] c(20)) [/color]