CSV Change value

Dman

Active Member
Licensed User
Longtime User
Let me try to explain this correctly.

I am adding an undelete feature to my app. I have it saving the data to a csv file when deleting and importing the data back into the database when undeleting. That works fine. The problem that I think that I might run into is that when deleting, it saves the row number (primary key) as a value in the cvs file. In sqlite, I THINK that when a row is deleted, sqlite will recycle the row number. If that is true then I will have issues when trying to insert the row back into the table.

I am figuring that when saving I have to either save the row number as NULL or replace it with NULL once it is saved, correct?

Any ideas or better methods would be greatly appreciated.

Here is my code to save it.

B4X:
                     Dim table1 As List
                        table1 = DBUtils.ExecuteMemoryTable(Main.SQL1, "SELECT * FROM invoice WHERE invoicenumber = '" & ftpinvnum & "'", Null, 0) 
                     Dim si As StringUtils
                        si.SaveCSV(File.DirDefaultExternal & "/DeletedInvoices/", "invoice_" & ftpinvnum & ".csv", ";", table1)
 
Last edited:

Dman

Active Member
Licensed User
Longtime User
It sounds like it will be simpler to add a "delete" column to your table. You can then set its status instead of actually deleting the data.

I guess sometimes the best way to do something is the simplest. I never thought of that.

Thanks Erel!
 
Upvote 0
Top