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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How i can include a tittle line with the names of fields ? 1

Status
Not open for further replies.

capri1966

Programmer
May 13, 2010
57
ES
Hi, i have to convert a dbf file into a csv archive but the first line must have the names of every field. How i could do this file ?. Help please.
The csv file appears with the content of fields correctly but i don't know how to include a header with the names o fields.

Thanks
 
A glance at the VFP Help will tell you that the CSV format has the field names embedded:

From the Help for [tt]COPY TO ... TYPE CSV[/tt]:

Creates a comma separated value file. A CSV file has the field names as the first line in the file, and the field values in the remainder of the file are separated with commas

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Watch out for memo fields... they are not included and you did say 'every field'


Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
I assume capri used COPY TO DELIMITED so far, and that has the same weakness about Memos.

VFP does not handle multiline values by the norm, both in appending CSV and creating it.

If you want total control, you can look into my faq184-7770

Bye, Olaf.

Olaf Doschke Software Engineering
 
Olaf, one very small error in your code:

For the logical case ([tt]lcType = 'L'[/tt]), I think the comment should say [tt] && process logical Fields [/tt] rather than [tt] && process numeric Fields[/tt].

It doesn't affect your logic, of course.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
That's fixed. Thanks, Mike.

I now also changed it to a function with usage code. There's still some room for improvement and adaption, like not outputting field by field, but actually there is enough caching of filesystem and drive hardware so the output is similarly fast to COPY TO or EXPORT.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top