Exception error creating csv file

Smee

Well-Known Member
Licensed User
Longtime User
Can someone see a problem with this code?

I get an exception error thrown when trying to create the csv file
java.lang.NullPointerException

B4X:
Cursor1=SQL.ExecQuery("Select * From Customers")
For i = 0 To Cursor1.RowCount - 1
    Cursor1.Position = i
    cols = Array As String(Cursor1.GetString2(0),Cursor1.GetString2(1),Cursor1.GetString2(2),Cursor1.GetString2(3),Cursor1.GetString2(4))
    list1.Add(cols)
Next

su.SaveCSV(File.DirRootExternal, "customers.csv", ",", list1)
Cursor1.Close
 

Smee

Well-Known Member
Licensed User
Longtime User
It seems there is a problem with the last field. if i drop the last field it works ok so it is something within my text
 
Upvote 0

Crolt

Member
Licensed User
Longtime User
I thought it was a similar problem...
But I have commented any action in the between!
I do not understand why the Load function find the file, while the Save not!
It should be in "File.DirAssets"?
Thank you for your help...

B4X:
      'Load saved Parameters
   'It contains the name of the others files and the selected parameters
   List0.Initialize
   
   Try
      List0 = strUt.LoadCSV(File.DirAssets, "config.ini", colon)
   Catch
      ToastMessageShow("Error: "&LastException.Message, True)
   End Try

   'Changes the modified value
   indL = List0.Size
   'For indI = 0 To indL-1
   '   ReadRow0 = List0.Get(indI)
   '   If ReadRow0(1) = strSelectedTable Then
   '      ReadRow0(2) = rc.Row
   '      List0.Set((indI), ReadRow0)
   '   End If
   'Next

   'Writes new value
   Try
      strUt.SaveCSV(File.DirAssets, "config.ini", colon, List0)
   Catch
      ToastMessageShow("Error: "&LastException.Message, True)
   End Try
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…