Android Question Page total b4xtable

harinder

Active Member
Licensed User
With bb4xtable not being vertically scrollable, I have to display page total of items in last row of every page, which gets carried forward to next page.
Suppose I have 3 pages and total 15 rows, with each page displaying 5 rows(for demo purpose and understanding), each page desired layout as follows:
B4X:
     Page1
  300  230 250(C/F previous)
   5    6   4
   4    3   2
   4    3   5
  313  242 261

      Page2
  313  242 261
   6    5   4
   4    5   6
   3    6   7
  326  258 278

      Page3
  326  258  278
   2    5    6
   5    4    3
   3    9    12
  335  276  299

The data is from db using sql. Does the sql command set this pattern for every page, or is possible to use B4xtable code to achieve this?
I was using flexitable earlier, which could be verically scrolled to the bottom that had one TOTAL(using UNION ALL sql command)..
 
Last edited:

harinder

Active Member
Licensed User
I tried:
B4X:
B4XTable1.AddColumn("Red", B4XTable1.COLUMN_TYPE_Text)
   B4XTable1.AddColumn("Green", B4XTable1.COLUMN_TYPE_TEXT)
   B4XTable1.AddColumn("Blue", B4XTable1.COLUMN_TYPE_TEXT)

   Dim Data As List
   Data.Initialize
   Dim rs As ResultSet = sql.ExecQuery("SELECT sum(Red) as Red, sum(Green) as Green, sum(Blue) as Blue FROM carryforward")
   Do While rs.NextRow
       Dim row(2) As Object
       row(0) = rs.GetString("Red")
       row(1) = rs.GetString("Green")
       row(2) = rs.GetString("Blue")
    
   Data.Add(row)
   Loop
   rs.Close

Dim rs As ResultSet = sql.ExecQuery("SELECT Red, Green, Blue, FROM present")

Do While rs.NextRow
       Dim row(2) As Object
       row(0) = rs.GetString("Red")
       row(1) = rs.GetString("Green")
       row(2) = rs.GetString("Blue")
Data.Add(row)
   Loop
   rs.Close
B4XTable1.SetData(Data)

I am getting:
B4X:
     Page1
  300  230 250(C/F previous)
   5    6   4
   4    3   2
   4    3   5
   6    5   4

      Page2
   4    5   6
   3    6   7
   2    5   6
   5    4   3
   3    9   12

      No Page3
How can I achieve page total in last row and carryforward total to next page to achieve result as in first post? Thnx
 
Upvote 0
Top