Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

APPEND FROM with Empty DateTime fields

Status
Not open for further replies.

jcbirch

MIS
Dec 16, 2004
18
US
Hi,

I'm using VFP 6.0 with Service Pack 5. I'm trying to automate an import process because I have to repeatedly import multiple tab-delimited text files. I am creating a new table structure, then using the "APPEND FROM" command to import the data.

My issue is this: if one of the datetime fields is empty in the text file, this screws up the remaining fields for that data record. My guess is that it is treating consecutive tab delimiters as one, but only for datetime fields.

For example, if I'm importing the following two records:
"Birch" "TX" "Dallas"
"Maple" 2/4/2003 0:00:00 "CA" "Oakland"

...Into the following table structure:
CREA TABL temp ( ;
tree c(15) ;
, sited t(16) NULL ;
, state c(10) ;
, city c(25))

...What I'll end up with is "Dallas" in the state field for the first record. The state, "TX," goes to never-never land. The second record is fine.

Please help me figure out an automated way around this!!!

Thanks,
Jessica
 
If you read the text file into memory then you can replace every double tab with tab+EmptyDate+tab:
Code:
strFile = strtran(strFile, chr(9)+chr(9), chr(9)+"{ / / }"+chr(9))
You'll have to take a close look at the text file to make sure that there're aren't any spaces wherre the empty date should be between the tabs.

Geoff Franklin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top