Import/Export from/to CSV files (; separator)

User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Import/Export from/to CSV files (; separator)

Post by Silvio.Falconi »

Marc Venken wrote:
Silvio.Falconi wrote:
Marc Venken wrote:I use this : (found from the forum)

Maybe this be be updated of made better.

Silvio :
where is the source code complete ?
This function i have found on the forum. What would you like more ?
the problem is on function Builddbf(adata,Alengte,cDbf)

if the header is

Code: Select all

Articolo;variante;Simili;Codice;Descrizione;Desc_breve;Desc_sint;tecnica;Reparto;Categoria;Marca;Codice_pro;misura;Esistenza;Disponib;Ubicazione;EAN13;Code128;Code39;Immagine;Tipocosto;Costo;Prezzo_ven;Ultprezzo;Aliquota;Note;Note_testo;Allegati;Conto_ven;Conto_acqu
n=0
for i = 1 to len(aData)
cField := aData

cField is all line and it is bad because cField must be the string until the ";" symbol

then this function e not create array astru good
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: Import/Export from/to CSV files (; separator)

Post by Silvio.Falconi »

Correct

function Builddbf(aHeader,Alengte,cDbf,cdeli)
local aStru := {}
local aFields := HB_ATokens(aHeader[1], cdeli )

for i = 1 to len(aFields)
cField = (aFields)
aAdd( aStru, { cField , "C", 255 , 0 } ) // I insert 255 is the max lenght
next
dbCreate( cDbf , aStru )
return nil

Now the problem is
1) how take the other lines
2) add the record on dbf created
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Post Reply