ExecuteMemoryTable Help

Bernd68

Member
Licensed User
Longtime User
I use the DBUtils Code Modul in the following way:

B4X:
DBUtils.ExecuteMemoryTable(SQL1,"Select * From tbltest",Null,0)

This works as much as i can see.

Now i would like to access a value stored in "table" as created by the code module.

B4X:
   Dim table As List
   table.Initialize
   If Limit > 0 Then Limit = Min(Limit, cur.RowCount) Else Limit = cur.RowCount
   For row = 0 To Limit - 1
      cur.Position = row
      Dim values(cur.ColumnCount) As String
      For col = 0 To cur.ColumnCount - 1
         values(col) = cur.GetString2(col)
      Next
      table.Add(values)
   Next

So how can i "read" the values of the List "table" from the main module?
Could not find a hint in the documentation or Forum.

A code example would be very appreciated

Thx Bernd
 

Bernd68

Member
Licensed User
Longtime User
Hi Erel,

thank you for your reply.

I still can t get around it.
Please note that i call "ExecuteMemoryTable" from my Main-Module
and want to read values from the table generated in the DBUtils Module

I followed your advice and get an error "Variable table not declared"

This is the code i have in the main module and "table" is in "red"
B4X:
DBUtils.ExecuteMemoryTable(SQL1,"Select * From ivents",Null,0)

Dim values() As String
values = table.Get(0)
Log(values(0)) 'log first column

Thx for your help. Any idea?
 
Upvote 0

Bernd68

Member
Licensed User
Longtime User
Hi Erel,

the last piece you wrote was what is missed :sign0098:

My intension is to read a table into "memory" = list and then reuse it whenever i need some values from the table

Thank you for getting me the right direction

Bernd
 
Upvote 0

PaulusPaulus

Member
Licensed User
Longtime User
Hi Erel
I've read various forum threads, but can't get my test clone of sqliteviewer to work for when you click on the item in the table (TableActivity).
I'm unsure of the "Main.SQL" bit - should that work?
Can you help, please? I don't really want to go back to using plain text files. My database is 8mb, but will soon be double/tripled, and already it's slowing down. Just wanted a price/field value to show, but no good...
Help!
Thanks.

Sub WebView1_OverrideUrl (Url As String) As Boolean
Dim table As List
table = DBUtils.ExecuteMemoryTable(Main.SQL,"Select * From savey",Null,0)
Dim values() As String
Dim col, row As Int
col = values(0)
row = values(1)
'Dim values(), string_SQL As String
'values = Regex.Split("[.]", Url.SubString(7))
values=table.Get(0)
'Dim table As List
'table = DBUtils.ExecuteMemoryTable(Main.SQL,"Select * From savey",Null,8000)
'Dim values() As String
'''''''''''''''''''''''''''''''values = table.Get(row)
ToastMessageShow("User pressed on column: " & col & " and row: " & row & "---" & values, False)
Return True 'Don't try to navigate to this URL

End Sub
 
Upvote 0
Top