Android Question Problem with Flexgrid not showing all the rows from a database

BigBoss123

Member
Licensed User
Longtime User
Here is an example of using flexgrid where the last row from the database is not shown

B4X:
Private Sub btnSearch_Click
    Dim pos, pos1, pos2 As String
    Dim bar1 As Int
    Dim ware1 As String
    Dim date1 As String
    Dim corr1 As Double
    Dim rs As DBResult
    Dim id As String = cmbox.SelectedItem
    
    Dim Parameters() As String = Array As String(id)
    Wait For(B4XPages.MainPage.jRDC.GetRecord("getproductscust", Parameters)) Complete (Answer As Map)
    If Answer.Get("Success") Then
            
        rs = Answer.Get("Data")
        x = 0
        For Each row() As Object In rs.Rows
            bar1 = (row(rs.Columns.Get("barcode")))   
            date1 = (DateTime.Date(row(rs.Columns.Get("date"))))
            corr1 = (row(rs.Columns.Get("currentbal")))
            If rs.Columns.Get("warehouse") > -1 Then
                ware1 = (row(rs.Columns.Get("warehouse")))
                pos = ware1.SubString2(0,1)
                pos1 = ware1.SubString2(1,3)
                pos2 = ware1.SubString2(3,4)
            Else
                pos = ""
                pos1 = ""
                pos2 =""
            End If
            FlexGrid1.AddRow(Array As Object(x,bar1,date1,pos,pos1,pos2,corr1,False),True)
            x = x + 1
                
        Next
    End If
End Sub

Now the Screenshot is as follows
View attachment 110389

But the log shown two rows should be shown
50600 26890 109 Cirrus Estate 9 LOC 2 2013 0.407 1393455600000 617.0 96.0
51016 27306 109 Cirrus Estate 17 C/S 22 2013 0.279 1399586400000 600.0 60.0

Any ideas why this is happening?

Thanks
 

josejad

Expert
Licensed User
Longtime User
What if you log(x) after adding 1? Does it fit with your rows number?
 
Upvote 0

BigBoss123

Member
Licensed User
Longtime User
Ok Logs x after adding 1, and it shows correctly the right number. Here is the log. so it shows the correct count.
cirrus1.PNG
 
Upvote 0
Top