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

Comma's and quotes

Status
Not open for further replies.

SBTBILL

Programmer
May 1, 2000
515
US
I'm attempting to import Peachtree inventory information into VFP6. Peachtree exports a CSV file format that is readable by EXCEL and I can get Foxpro to read it also. Problem is the data includes quotes in the form of inch marks i.e. widgit 7 7/8". This is throwing the fields off. The import wizard will handle it but I need a solution that can be run from within a program. Anybody know of a way to tell fox to only look at the coma's and not the quotes.

Bill Coutue
 
SELECT myTable
Append from mycsv.cvs DELIMITED WITH ","

Might do it.
 
Not sure if I fully understand where you are with the conversion.
1. Look at the import function and the import wizard

2. if the table already exist. check out the
APPEND FROM Filename DELIMITED WITH ','

Indicates that character fields are separated by a character other than the quotation mark.

Attitude is Everything
 
Import Wizard will do it but isn't a solution as this is part of the front end for a report that will be regularly run. Thus the data has to be exported and imported more then once.

Tried the delimited with last night before posting this. Doesn't seem to solve the problem.

Bill Couture
 
If your data is coming in as such:

"field1","field2","field3"

Use 'Append from [yourfile] delimited'

When you look at the raw data file, it may look as shown above. If it does, this will soak it right in.

I have had no problems appending cvs files this way, although, I have to admit, I am not sure what a cvs file is, except it seems to be associated with certain versions of Excel.

Am only working with VFP 5.0, so there may be more you can learn from those who have the advantage of working in VFP 7.

Culleoka
 
Try importing all of the data into a memo field and then scan through the file and use:
chrtran(memofield,CHRTRAN(x,CHR(34),""),"") to remove the quotes.

You can then copy the data back to a text file and then import it into your final table as a regular delimited file.

Brian

&&&&&
create temp (memofield m)
append from exportdata.csv type sdf
go top
scan
repl memofield with chrtran(memofield,CHRTRAN(x,CHR(34),""),"")
endscan

copy memo memofield to fixed_exportdata.csv type sdf

use MyLayout
append from fixed_exportdata.csv type delim
 
That was supposed to be CHRTRAN(memofield,CHR(34),"")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top