append from csv

Hi

We are using vfp7. When i use this append i get 30 empty records but my csv file has only 4 records with infromation.


APPEND from c:\potash\import\import.csv fields ima_key,ima_sec,attrib1,attrib2,attrib3,attrib4,attrib5,attrib6,attrib7,attrib8,attrib9,attrib10,attrib11,attrib12,attrib13,orig_mfg,orig_mfgpn,uom,addit_info,cust_spec,port_id,port_type,itemnum type csv

Open in new window

RVLAsked:
Who is Participating?
 
pcelbaConnect With a Mentor Commented:
The import.CSV file from your post is not in standard CSV format. It is some data file having field names and data inside but the format is neither CSV nor DBF and I am afraid, VFP cannot read it by APPEND FROM command.

The file format seems somehow to be fixed, so you could write a small program which will read it by low level file functions and create a DBF table on output.

The file is probably exported from some other application. Is there any possibility to obtain different file format?
0
 
pcelbaCommented:
Sample of your CSV file and DBF structure (created as COPY STRUCURE TO stru.DBF) would help a lot.
0
 
RVLAuthor Commented:

Hi
I had to save it as a txt because it will not allow me to attach a bdf file. Hope this helps
list STRUCTURE TO file stru.txt noconsole
import.csv
stru.txt
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
pcelbaCommented:
If you use COPY STRUCTURE TO NewFile and then rename

NEWFILE.DBF to NEWFILE.DBF.TXT
and possible
NEWFILE.FPT to NEWFILE.FPT.TXT

it should be possible to post such structure as you may see just now.

(Sorry I am too lazy to create the table :-)
autostru.dbf.txt
autostru.FPT.txt
0
 
RVLAuthor Commented:
Hi

Hope this works
Thanks
stru.dbf.txt
stru.FPT.txt
0
 
pcelbaCommented:
The structure sent is perfect now.
0
 
pcelbaCommented:
Following command should append slightly updated import file. Field order in APPEND must be derived from the import file contents. Double quotes cannot be used as field separator because it is contained in data. The conversion program is about 50 lines.
APPEND FROM import.txt FIELDS port_id,port_type,orig_mfg,orig_mfgpn,addit_info,cust_spec,itemnum,ima_key,ima_sec,attrib1,attrib2,attrib3,attrib4,attrib5,attrib6,attrib7,attrib8,attrib9,attrib10,attrib11,attrib12,attrib13,UOM TYPE DELIMITED WITH |

Open in new window

import.txt
0
 
RVLAuthor Commented:
Hi

Looks like we will have to find something other than the csv

Thanks for the help
0
 
pcelbaCommented:
Or you may convert existing "CSV" to | delimited format.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.