?
Solved

append from csv

Posted on 2009-12-23
9
Medium Priority
?
779 Views
Last Modified: 2012-05-08
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

0
Comment
Question by:RVL
  • 6
  • 3
9 Comments
 
LVL 43

Expert Comment

by:pcelba
ID: 26113386
Sample of your CSV file and DBF structure (created as COPY STRUCURE TO stru.DBF) would help a lot.
0
 

Author Comment

by:RVL
ID: 26113732

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
 
LVL 43

Expert Comment

by:pcelba
ID: 26113870
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:RVL
ID: 26113945
Hi

Hope this works
Thanks
stru.dbf.txt
stru.FPT.txt
0
 
LVL 43

Accepted Solution

by:
pcelba earned 2000 total points
ID: 26113964
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
 
LVL 43

Expert Comment

by:pcelba
ID: 26114001
The structure sent is perfect now.
0
 
LVL 43

Expert Comment

by:pcelba
ID: 26115223
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
 

Author Closing Comment

by:RVL
ID: 31669464
Hi

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

Thanks for the help
0
 
LVL 43

Expert Comment

by:pcelba
ID: 26115920
Or you may convert existing "CSV" to | delimited format.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
LinkedIn blogging is great for networking, building up an audience, and expanding your influence as well. However, if you want to achieve these results, you need to work really hard to make your post worth liking and sharing. Here are 4 tips that ca…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Screencast - Getting to Know the Pipeline
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question