Conversation

FDDataMove CSV to FDMemTable1

(overview of excerpts from articles in conversation)

Newsgroup: embarcadero.public.delphi.database.firedac

# Lines
wrote on 29-Oct-2013:

Can anyone supply example easy way how to use FireDac to load CSV file into FDMemTable, and then (after edit, rename columns, drop columns) move result data to new table in database (Firebird)..
I have managed MoveData to import data from CSV, but only if I prepare fields in MemTable. But, how to do it automatically (read column names from CSV file, setup fields in memtables, etc.)?


15
  
Dmitry Arefiev replied on 30-Oct-2013:

Hello
  (snip)

FDDataMove1.Destination := FDMemTable1;
  FDDataMove1.SourceKind := skText;
  FDDataMove1.TextFileName := '.......';
  FDDataMove1.TextAnalyze := [taDelimSep, taHeader, taFields];
24
    
me me replied on 30-Oct-2013:

Dmitry
    I was happy and surprised for simplicity of those commands (still undocumented?).
    However, it seams that there is some bug. If I have fields of different types in CSV (3 x text fields and 1 integer field) then everything is ok. Fields are recognized and named according to first line in CSV, and data is imported.
    But if I have 3 text fields in CSV like this:
    LOGINID;PERSONID;PASSWORDINPUT
34
      
Dmitry Arefiev replied on 30-Oct-2013:

(snip)

Still not.
      (snip)

Exclude taHeader. Otherwise FireDAC recognizes all
      that as 3 data rows.
      --
      With best regards,
19
        
me me replied on 30-Oct-2013:

Super, thank you ..
        FireDac seams very powerful ..
        
        
        
2
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Sun, 12 May 2024 23:39:33 UTC
Copyright © 2009-2024
HREF Tools Corp.