Android Question list question

padvou

Active Member
Licensed User
Longtime User
Let's suppose we have following code:
B4X:
cursor1 = SQL1.ExecQuery("select CODE, NAME,  PHONE11, LDDATE, LCDATE from BALANCE order by NAME asc")

        For i = 0 To cursor1.RowCount - 1
        cursor1.Position = i
        Slist.add(???)
        Next
       
        cursor1.close

Then we want to add the first row to another list:
B4X:
Dim row As List
    Dim cols As Int   
    Dim rows As Int
    row.Initialize
        rows = Slist.Size   
        Log(Slist.Get(0))
        row=Slist.Get(0)  'Header row
       
       
        cols = row.Size

What should the code be in the questionmarks, so that each row of the Slist list can be added as an array in the row list?
 

padvou

Active Member
Licensed User
Longtime User
I tried using this:
B4X:
        Slist.add(cursor1.GetString2(0) & TAB & cursor1.GetString2(1) & TAB & cursor1.GetString2(2) & TAB & cursor1.GetString2(3) & TAB & cursor1.GetString2(4) & TAB & cursor1.GetString2(5) & TAB & cursor1.GetString2(6) & TAB & cursor1.GetString2(7) & TAB & cursor1.GetString2(8))

and then split it like this:
B4X:
row.Add(Regex.Split("/t",Slist.Get(0)))
but the row.size returned is always 1.
 
Upvote 0

padvou

Active Member
Licensed User
Longtime User
ok, I answered my own question...
B4X:
row.Add(Regex.Split("/t",Slist.Get(0)))
should be
B4X:
row.Add(Regex.Split("\t",Slist.Get(0)))
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
B4X:
    cursor1 = sql1.ExecQuery("select CODE, NAME,  PHONE11, LDDATE, LCDATE from BALANCE order by NAME asc")

  For i = 0 To cursor1.RowCount - 1
  cursor1.Position = i
      Slist.add(cursor1.GetString("colname"))
  Next
 
Upvote 0

padvou

Active Member
Licensed User
Longtime User
B4X:
    cursor1 = sql1.ExecQuery("select CODE, NAME,  PHONE11, LDDATE, LCDATE from BALANCE order by NAME asc")

  For i = 0 To cursor1.RowCount - 1
  cursor1.Position = i
      Slist.add(cursor1.GetString("colname"))
  Next

I get this:
java.lang.IllegalArgumentException: column 'colname' does not exist
 
Upvote 0
Top