Page 1 of 1

Read CSV file in order to APPEND in DBF file

Posted: Wed May 29, 2013 8:20 am
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

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

Posted: Wed May 29, 2013 9:27 am
by esgici
After defined properly structure of your .dbf, you can try :

Code: Select all

APPEND FROM <cvsFileSpec> DELIMITED

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

Posted: Wed May 29, 2013 9:44 am
by serge_girard
Yeah, just like in the old days!

Thx,


Serge

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

Posted: Thu May 30, 2013 9:40 am
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

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

Posted: Thu May 30, 2013 10:33 am
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

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

Posted: Thu May 30, 2013 10:47 am
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.

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

Posted: Thu May 30, 2013 12:11 pm
by serge_girard
Nick,

not possible to make a different export file?


S

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

Posted: Thu May 30, 2013 12:56 pm
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.