PROCEDURE ImportCSVdata(sFullFileName is string)
sCsvSeparator is string = ";"
sCsvRow is string
nFileNum is int
nLoop is int
nCol is int
nJumCol is int = 1
// Create a Table Control with the sufficient (more) column
TableDeleteAll(TABLE_Table1)
nFileNum = fOpen(sFullFileName,foRead)
IF nFileNum = -1 THEN
Error("File not found!")
ELSE
LOOP
sCsvRow=fReadLine(nFileNum)
nCol=1
FOR nLoop = 1 TO Length(sCsvRow)
IF sCsvRow[[nLoop]] = sCsvSeparator THEN
sCsvRow[[nLoop]] = TAB
nCol ++
END
END
TableAdd(TABLE_Table1,sCsvRow)
IF sCsvRow = EOT THEN BREAK
END
fClose(nFileNum)
FOR x = 1 TO TableCount(TABLE_Table1)
myfield1 = TABEL_Table1.column1[x]
myfield2 = TABLE_Table1.column2[x]
....
// Put your logic to HAdd or Hmodify here
....
END
END
HTH
Toddy
Edited 2 time(s). Last edit at 08/04/2009 10:34AM by Toddy Utomo.