Nor sure how to formulate it differently.
I call SaveCSV2() with a list that has 276 records but I get only 175 records in the CSV file.
I start from an SQLite database. I enter the code below with a Cursor containing the entire database.
I check the rowcount of the cursor and it indicates 276.
I check the size of the list right before calling SaveCSV2() and it shows 276.
Yet the file only has 175 records.
The missing records are not at the beginning or the end, they are anywhere in between. I have the feeling that it may be content related, but as the code shows, I check that all the fields have non-null content and I also remove the CRLF that may be in some fields.
I am surprised that the SaveCSV2() function skips records without complaining about something.
Any help as to where to start looking would be appreciated.
PS: I did earlier testing of the code with a short database (a dozen records) and everything was working fine, so I did not expect this
I call SaveCSV2() with a list that has 276 records but I get only 175 records in the CSV file.
I start from an SQLite database. I enter the code below with a Cursor containing the entire database.
B4X:
Dim LogList, hdr as List
LogList.Initialize
hdr.Initialize2( Array As String( "Date", "Amount","Business" ,"Category", "Description", "Vendor", "Bank", "Picture" ))
Log( "ExportDB.CSV.Log.RowCount: " & Cursor1.RowCount
' now save data
For row = 0 To Cursor1.RowCount - 1
Private RowData( Cursor1.ColumnCount ) As String
Cursor1.Position = row 'set the Cursor to each row
' save the date
RowData( 0 ) = DateTime.Date( Cursor1.GetLong2( 0 ) )
' then save the data columns
For col = 1 To Cursor1.ColumnCount-1
If Cursor1.GetString2( col ) <> Null Then
RowData( col ) = Cursor1.GetString2( col ).Replace( CRLF, " " ) ' eliminate new line that may be embedded in Description field
Else
RowData( col ) = ""
End If
Next
LogList.Add( RowData )
Next
Log( "ExportDB.CSV.LogList.Size = " & LogList.Size )
hdr.Initialize2( Array As String( "Date", "Amount","Business" ,"Category", "Description", "Vendor", "Bank", "Picture" ))
su.SaveCSV2( Starter.DownloadPath, FileName, ",", LogList, hdr )
I check the size of the list right before calling SaveCSV2() and it shows 276.
Yet the file only has 175 records.
The missing records are not at the beginning or the end, they are anywhere in between. I have the feeling that it may be content related, but as the code shows, I check that all the fields have non-null content and I also remove the CRLF that may be in some fields.
I am surprised that the SaveCSV2() function skips records without complaining about something.
Any help as to where to start looking would be appreciated.
PS: I did earlier testing of the code with a short database (a dozen records) and everything was working fine, so I did not expect this