Hi Joe,
Some things you can check for in your character fields before you append are:
CHR(10)
CHR(13)
CHR(2)
CHR(3)
CHR(4)
Replace those with a blank if they exist.

Also see if some of the character fields (like addresses) have a comma in them 
that might be separating it into a column before you want it to.

-Philip B.

---------- Original Message ----------
From: Joe Yoder <j...@wheypower.com>
To: profoxt...@leafe.com
Subject: .csv file imports to VFP
Date: Sat, 15 Apr 2023 22:35:14 -0400

I have an accounting system data dump that I export each year at tax time,
I think I have always had a few records that got mangled but this year I
would like to solve the problem.

My preferred technique is to create a cursor with the fields I need to
import along with any required place holders.  I then append from the ,CSV
file type delimited.  This is very fast and seems to be perfect except for
about 24 records out of 10,000.  What happens is that fields that belong in
later positions in some records show up in the first field position.  It
seems some records are handled as though they have a carriage return
linefeed too early and what follows ends up at the beginning of the
following record.

I have investigated Low level file input using an fgets function to pull
records out one at a time.  This is obviously slower and still seems to
have the same problem.

Another possible approach would be to pull the entire file into memory and
parse everything out from there.  This will take much more time and be a
lot of work to set up but might make sense to try.

Finally I have opened the file in Excel with no problem.  Some of the
fields that want to show up in the left field in VFP stay where they belong
in Excel.  I don't like to add a process in another package but it may make
sense to do so.

Any wisdom will be much appreciated.
Thanks in advance,

Joe


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/20230416.170915.791...@webmail01.dca.untd.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to