I have a B4XTable populated from an SQLite database with 19,056 records/rows.
When the app starts, it displays everything just fine... all records from 2005 to 2022.
At times, I need to be able to refresh the table with ONLY new 2022 data. Here's my attempt:
First I clear the data of the B4XTable with SetData(Array()).
Then I remove the current 2022-dated records from the SQLite database.
Then I add back to the SQlite database the updated 2022 records.
Then I reload all the data from the SQLite database into an array.
Then I re-populate the B4XTable with the new SQlite data.
What happens on the display is I end up seeing TWO copies of each 2022 record.
If I restart the app, those duplicates are gone. Everything looks normal again.
What am I doing wrong when re-populating the B4XTable and getting the duplicate 2022 records?
When the app starts, it displays everything just fine... all records from 2005 to 2022.
At times, I need to be able to refresh the table with ONLY new 2022 data. Here's my attempt:
B4XTable Refresh Sub:
Private Sub btn_Refresh_Click
Log("Emptying B4XTable")
tbl_Codes.SetData(Array())
tbl_Codes.UpdateTableCounters
' tbl_Codes.ClearDataView
' TableSelections.Clear
Log("Building SQLite Database from legacy files")
Log("Cleaning 2022 data")
Clean2022FromDatabase
Log("Converting legacy text files")
ConvertLegacyCodesToSQliteDB
Log("Loading new SQLite database")
LoadCacheFromSqlite
Log("Populating B4XTable")
wait for (tbl_Codes.SetData(keysList)) complete (res As Object)
Log("Refreshing B4XTable")
tbl_Codes.RefreshNow
Log("Done!")
End Sub
First I clear the data of the B4XTable with SetData(Array()).
Then I remove the current 2022-dated records from the SQLite database.
Then I add back to the SQlite database the updated 2022 records.
Then I reload all the data from the SQLite database into an array.
Then I re-populate the B4XTable with the new SQlite data.
What happens on the display is I end up seeing TWO copies of each 2022 record.
If I restart the app, those duplicates are gone. Everything looks normal again.
What am I doing wrong when re-populating the B4XTable and getting the duplicate 2022 records?