.
Last edited:
Dim table1 As List
table1 = DBUtils.ExecuteMemoryTable(SQL1, "SELECT * FROM database1", Null, 0)
Dim si As StringUtils
si.SaveCSV(File.Whereveryouwanttosaveit, "whatever.csv", ";", table1)
table1.Clear
Sub ExportToCSV
Dim CSVList As List
CSVList.Initialize
db.FirstRecord
For i = 0 To db.Record_Count -1
Dim NewRecord As String
For ii = 0 To db.ActiveFields -1
If ii < db.ActiveFields -1 Then
NewRecord = NewRecord & db.GetField("var" & ii) & ","
Else
NewRecord = NewRecord & db.GetField("var" & ii) & CRLF
End If
Next
CSVList.Add(NewRecord)
db.NextRecord
Next
File.WriteList(File.DirRootExternal, "newlist.csv", CSVList)
End Sub
NewRecord = NewRecord & db.GetField("var" & ii+1) & ","
NewRecord = NewRecord & db.GetField("var" & ii+1) & CRLF
For ii = 0 To db.ActiveFields -1
Dim Header As String
If ii < db.ActiveFields -1 Then
Header = Header & "var" & ii+1 & ","
Else
Header = Header & "var" & ii+1 & CRLF
End If
Next
CSVList.Add(Header)
'Create header on top row of CSV
For ii = 1 To db.ActiveFields
Dim Header As String
If ii < db.ActiveFields Then
Header = Header & "var" & ii & ","
Else
Header = Header & "var" & ii
End If
Next
'Create header on top row of CSV
Dim Header As String
For ii = 1 To db.ActiveFields
If ii < db.ActiveFields Then
Header = Header & "var" & ii & ","
Else
Header = Header & "var" & ii
End If
Next
Type DataDetails (WAFileName As String, WAFilePath As String, WAField(30) As String, WAPointer As Int, WARecordCount As Int)