Read CSV file in order to APPEND in DBF file

Moderator: Rathinagiri

Post Reply
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Read CSV file in order to APPEND in DBF file

Post by serge_girard »

Hello all!

Is there any function that reads and divides CSV file into records/fields?

I have a CVS file like this:

"field1","field2","field3",,"field5",,,,"fieldx","fieldx+1","..","....",,".....",,"field y ",,,

number of fields is an fixed number.

The files comes from an phpMyadmin export.

Greetings and thx,

Serge
There's nothing you can do that can't be done...
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Read CSV file in order to APPEND in DBF file

Post by esgici »

After defined properly structure of your .dbf, you can try :

Code: Select all

APPEND FROM <cvsFileSpec> DELIMITED
Viva INTERNATIONAL HMG :D
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Read CSV file in order to APPEND in DBF file

Post by serge_girard »

Yeah, just like in the old days!

Thx,


Serge
There's nothing you can do that can't be done...
NickSteel
Posts: 67
Joined: Mon May 27, 2013 10:44 pm

Re: Read CSV file in order to APPEND in DBF file

Post by NickSteel »

serge_girard wrote:Hello all!

Is there any function that reads and divides CSV file into records/fields?

I have a CVS file like this:

"field1","field2","field3",,"field5",,,,"fieldx","fieldx+1","..","....",,".....",,"field y ",,,

number of fields is an fixed number.

The files comes from an phpMyadmin export.

Greetings and thx,

Serge
I'm pursuing something very similiar. You may want to follow this:

http://hmgforum.com/viewtopic.php?f=5&t=2972&start=0
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Read CSV file in order to APPEND in DBF file

Post by serge_girard »

Hello Nick,


I changed the whole thing.

Instead of making an EXPORT CSV file (download->upload) I read the SQL database and then APPEND each record in a DBF file. Very fast and prettier!

Some of the SQL database fields contains comma's, quotes etc. so an APPEND from DELI SDF wasn't an option and writing code for reading byte per byte is more error sensitive.

Greetings,

Serge
There's nothing you can do that can't be done...
NickSteel
Posts: 67
Joined: Mon May 27, 2013 10:44 pm

Re: Read CSV file in order to APPEND in DBF file

Post by NickSteel »

My problem is different. I am reading a Primavera P6 XER export file and loading the data into a analysis system I developed. My CSV file is huge, has different line content and length and has to be reformatted before updating existing DBF records.

Glad you found a solution.
User avatar
serge_girard
Posts: 3165
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Read CSV file in order to APPEND in DBF file

Post by serge_girard »

Nick,

not possible to make a different export file?


S
There's nothing you can do that can't be done...
NickSteel
Posts: 67
Joined: Mon May 27, 2013 10:44 pm

Re: Read CSV file in order to APPEND in DBF file

Post by NickSteel »

serge_girard wrote:Nick,

not possible to make a different export file?


S
No, the goal is to allow the user to produce an analysis report by selecting the most inclusive export file and not having to rely on Excel or some other software. Primavera has limited export formats available.
Post Reply