Android Question Save CSV File from Table

rodmcm

Active Member
Licensed User
In my coronvirus lockdown I decided to learn about tables, csv, sql etc

The enclosed program follows the save csv file examples on this forum, and the su.SaveCSV2 format shown by others
However mine doesn't work.. When I reopen the app the original file, unmodified is uploaded. No other files are created

Can someone point to where I am going wrong please....
 

Attachments

  • SaveCSVTest.zip
    14.3 KB · Views: 152

Bladimir Silva Toro

Active Member
Licensed User
I leave you the code that I use to export the SQLite information to a CSV file

B4X:
Dim mlist As List
    mlist.Initialize
    mlist=DBUtils.ExecuteMemoryTable(SQL,"Select * From MyTable Where ID>0",Null,0)
    If mlist.Size>1 Then
        Dim su As StringUtils
        su.SaveCSV(File.DirRootExternal,"archivo.csv",",",mlist)
        ToastMessageShow("OK",True)
    Else
        ToastMessageShow("Problems",True)
    End If
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
The problem is here:
data = su.LoadCSV2(File.DirAssets,Starter.DBFileName, ",", headers)
You always load the file from File.DirAssets, which is the orignal file!
And you save the file in File.DirInternal!?
su.SaveCSV2(File.DirInternal, Starter.DBFileName, ",", data1, headers)
You shoud first check if the file in File.DirInternal does exsit.
If no, save the file from File.DirAssets to File.DirInternal and always read the file from there.
 
Upvote 0
Top