R RB Smissaert Well-Known Member Licensed User Longtime User Feb 24, 2019 #1 Noticed with B4XTable that you can delete rows of the underlying memory table but that there seems to be no way to make this show properly in the table display. So, although the deleted rows don't show any data there still are the same number of rows and also pages. In the provided example I ran this code at the end of Activity_Create: Code: 'this does delete table rows, but doesn't remove pages or display rows B4XTable1.sql1.ExecNonQuery("delete from data where rowid > 100") B4XTable1.Refresh And that demonstrates the problem. I call it a problem as it would be nice if the display could be adjusted according to the deleted rows. Is there a way to do that? Not had a proper look at this (B4XTable) yet, but it seems the table display is only set by .SetData with the provided list. Would it be possible to add the option to set the data directly with SQL and setup the display from the table data rather than from the list? I think this would be very useful. Or am I overlooking something, and can this be done already? RBS
Noticed with B4XTable that you can delete rows of the underlying memory table but that there seems to be no way to make this show properly in the table display. So, although the deleted rows don't show any data there still are the same number of rows and also pages. In the provided example I ran this code at the end of Activity_Create: Code: 'this does delete table rows, but doesn't remove pages or display rows B4XTable1.sql1.ExecNonQuery("delete from data where rowid > 100") B4XTable1.Refresh And that demonstrates the problem. I call it a problem as it would be nice if the display could be adjusted according to the deleted rows. Is there a way to do that? Not had a proper look at this (B4XTable) yet, but it seems the table display is only set by .SetData with the provided list. Would it be possible to add the option to set the data directly with SQL and setup the display from the table data rather than from the list? I think this would be very useful. Or am I overlooking something, and can this be done already? RBS
Erel B4X founder Staff member Licensed User Longtime User Feb 25, 2019 #2 Why aren't you using CreateDataView? Code: B4XTable1.CreateDataView("rowid > 100", Null) Upvote 0
R RB Smissaert Well-Known Member Licensed User Longtime User Feb 25, 2019 #3 Erel said: Why aren't you using CreateDataView? Code: B4XTable1.CreateDataView("rowid > 100", Null) Click to expand... Ah, OK, thanks. Overlooked that one. RBS Upvote 0
Erel said: Why aren't you using CreateDataView? Code: B4XTable1.CreateDataView("rowid > 100", Null) Click to expand... Ah, OK, thanks. Overlooked that one. RBS
R RB Smissaert Well-Known Member Licensed User Longtime User Feb 25, 2019 #4 Erel said: Why aren't you using CreateDataView? Code: B4XTable1.CreateDataView("rowid > 100", Null) Click to expand... CreateDataView has only one parameter in the library I downloaded from the first post. Is there an updated library somewhere or do I need the files as in the example? RBS Upvote 0
Erel said: Why aren't you using CreateDataView? Code: B4XTable1.CreateDataView("rowid > 100", Null) Click to expand... CreateDataView has only one parameter in the library I downloaded from the first post. Is there an updated library somewhere or do I need the files as in the example? RBS
Erel B4X founder Staff member Licensed User Longtime User Feb 25, 2019 #5 It should be: Code: B4XTable1.CreateDataView("rowid > 100") Upvote 0
R RB Smissaert Well-Known Member Licensed User Longtime User Feb 25, 2019 #6 Erel said: It should be: Code: B4XTable1.CreateDataView("rowid > 100") Click to expand... I take it you meant: Code: B4XTable1.CreateDataView("rowid < 101") But that still shows all 275 pages. It looks .CreateDataView can work on the underlying memory table, but it doesn't alter the display accordingly. So how do I adjust the display after altering the memory table? RBS Upvote 0
Erel said: It should be: Code: B4XTable1.CreateDataView("rowid > 100") Click to expand... I take it you meant: Code: B4XTable1.CreateDataView("rowid < 101") But that still shows all 275 pages. It looks .CreateDataView can work on the underlying memory table, but it doesn't alter the display accordingly. So how do I adjust the display after altering the memory table? RBS
M Mahares Expert Licensed User Longtime User Feb 25, 2019 #7 RB Smissaert said: So how do I adjust the display after altering the memory table? Click to expand... This should work for you: Code: Sub btn_Click B4XTable1.CreateDataView("rowid < 101") 'show recs from 1 to 100 included End Sub Upvote 0
RB Smissaert said: So how do I adjust the display after altering the memory table? Click to expand... This should work for you: Code: Sub btn_Click B4XTable1.CreateDataView("rowid < 101") 'show recs from 1 to 100 included End Sub
R RB Smissaert Well-Known Member Licensed User Longtime User Feb 25, 2019 #8 Mahares said: This should work for you: Code: Sub btn_Click B4XTable1.CreateDataView("rowid < 101") 'show recs from 1 to 100 included End Sub Click to expand... But that still shows 275 pages and the wrong number of rows. Did you try it in the posted example? RBS Upvote 0
Mahares said: This should work for you: Code: Sub btn_Click B4XTable1.CreateDataView("rowid < 101") 'show recs from 1 to 100 included End Sub Click to expand... But that still shows 275 pages and the wrong number of rows. Did you try it in the posted example? RBS
M Mahares Expert Licensed User Longtime User Feb 25, 2019 #9 No sorry, I tried it in my own example and it worked for me. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Feb 26, 2019 #10 Please upload a project that demonstrates the issue. Upvote 0
R RB Smissaert Well-Known Member Licensed User Longtime User Feb 26, 2019 #11 Erel said: Please upload a project that demonstrates the issue. Click to expand... Attached the project. I marked the altered code, compared to the posted example. RBS Attachments B4XTable Example.zip B4XTable Example.zip 150.6 KB · Views: 600 Upvote 0
Erel said: Please upload a project that demonstrates the issue. Click to expand... Attached the project. I marked the altered code, compared to the posted example. RBS
Erel B4X founder Staff member Licensed User Longtime User Feb 26, 2019 #12 B4XTable.SetData is an asynchronous method. Change your code to: Code: B4XTable1.SetData(data) Do While B4XTable1.mCurrentCount = 0 Sleep(50) Loop B4XTable1.CreateDataView("rowid < 101") Upvote 0
B4XTable.SetData is an asynchronous method. Change your code to: Code: B4XTable1.SetData(data) Do While B4XTable1.mCurrentCount = 0 Sleep(50) Loop B4XTable1.CreateDataView("rowid < 101")
R RB Smissaert Well-Known Member Licensed User Longtime User Feb 26, 2019 #13 Erel said: B4XTable.SetData is an asynchronous method. Change your code to: Code: B4XTable1.SetData(data) Do While B4XTable1.mCurrentCount = 0 Sleep(50) Loop B4XTable1.CreateDataView("rowid < 101") Click to expand... Thanks, that solved the problem. RBS Upvote 0
Erel said: B4XTable.SetData is an asynchronous method. Change your code to: Code: B4XTable1.SetData(data) Do While B4XTable1.mCurrentCount = 0 Sleep(50) Loop B4XTable1.CreateDataView("rowid < 101") Click to expand... Thanks, that solved the problem. RBS