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!

fields on separate lines of text file 3

Status
Not open for further replies.

Phil Thoms

Programmer
Oct 31, 2005
245
GB
Hello,
A client has asked me if there is a way of importing a text file into VFP 6 with 1 field per line:-

field 1
field 2
field 3
field 4

field 1
field 2
field 3
field 4
field 5

There are 4 or 5 fields for each record, separated with a blank line.
I thought of importing text to a database and manipulating the fields and sending them into another database. However, I wondered if there is a quick format that's already in existence to deal with this situation.
Thanks
 
You may get this look visually, if you EDIT instead of BROWSE.
This visual mode also applies to the grid control and is controlled via its View property.

Besides that, no there is no automatic output of records as one field per row, you would need to be able to specify WITH CHARACTER CHR(13) in a COPY TO DELIMITED export, but you can only specify a printable character here, or TAB or BLANK, but not CHR(13) nor ^M nor ENTER or RETURN keywords.

So you better do that with TEXT..ENDTEXT and SET TEXTMERGE ON and TO FILE some.txt

Bye, Olaf.

 
if there is a way of importing a text file into VFP...

Not directly.

However as long as you could know FOR CERTAIN when a value was to go into a specific field (such as when Field1. etc. would ALWAYS appear) you could write your own small import program to receive all of the data into a single field and then (ONLY BY KNOWING FOR CERTAIN WHERE EACH FIELD VALUE WAS) you could read data out of that temporary 'import' table and put it into a properly formatted table.

Good Luck,
JRB-Bldr
 
Sorry, yes - importing. Why did I read exporting?

No, the best way will be using a single field import cursor and append from the text file, then go with your planned transformation process.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top