Android Question B4XTable SQL1 - CreateDataView

RB Smissaert

Well-Known Member
Licensed User
Longtime User
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:

B4X:
 '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

 

RB Smissaert

Well-Known Member
Licensed User
Longtime User
Why aren't you using CreateDataView?

B4X:
B4XTable1.CreateDataView("rowid > 100", Null)

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

RB Smissaert

Well-Known Member
Licensed User
Longtime User
It should be:
B4X:
B4XTable1.CreateDataView("rowid > 100")

I take it you meant:

B4X:
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

RB Smissaert

Well-Known Member
Licensed User
Longtime User
This should work for you:
B4X:
Sub btn_Click
    B4XTable1.CreateDataView("rowid < 101") 'show recs from 1 to 100 included  
End Sub

But that still shows 275 pages and the wrong number of rows.
Did you try it in the posted example?

RBS
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User

Thanks, that solved the problem.

RBS
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…