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!

CSV Delimated

Status
Not open for further replies.

mccartmd

Programmer
Feb 3, 2003
63
US
*!*Have temp3.csv file column8 has a value of '1.5455,9.21345' etc.
*!* i.e. "vibraphone" "3.90002" "1.5455" "2018-11-13 16:42:30"
*!* when I append it the value comes in as 3.0000 or as 1.00000
*!* temp3$Column1 and Column2 are set to numeric width 20 and decimal 6
*!* how can I capture the values with the decimal values to into my column1 & 2.dbf?
IF !USED('temp3')
USE temp3 in 0
ENDIF
SELECT temp3
APPEND FROM C:\Users\Bill\Desktop\temp3.csv DELIMITED
browse

Thanks for any help!!!!
J
 
Make sure you

Code:
SET POINT TO "."

before appending the file.
 
First of all, CSV would need commas, what you posted is perhaps using tabs originally, you post it as all single values being quoted and separated by spaces. Also, you need a DBF with the number of columns as given in the CSV.

As you at least get the values you likely don't have a problem with the format or target cursor structure, so I would conclude as atlopes already did and think you may simply need the right SET POINT setting.

There is one-way APPEND FROM another DBF is easier: VFP can match source and target fields by name, append from a CSV file you don't get this matching, VFP doesn't interpret the first line as header/field names, even if the CSV has that format. So you also can't just define a cursor with only a few fields of data you want to pick out, CSV is read in full, therefore the number of columns should at least be as many as in the CSV. And further difficulties are, APPEND will skip memo fields as target fields and won't recognize quoted text with linefeeds as a single value, it blindly reads line feeds as record end, even if the line feeds are within quotes and only part of the column value. So VFP only has limited CSV capabilities. These two restrictions should be no problem with the flat situation you have, though. It's likely just the number format in what is taken as the decimal point.

Bye, Olaf.



Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top