Page 2 of 2

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

Posted: Wed Nov 25, 2020 7:11 pm
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

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

Posted: Wed Nov 25, 2020 7:49 pm
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