Android Question B4XTable getting the values of a row : HOW TO ?

DALB

Active Member
Licensed User
Hello,

in this little code ...

b4XTable getting values of a row:
Sub B4XTable1_CellClicked (ColumnId As String, RowId As Long)   

Dim licol As Map = B4XTable1.GetRow(RowId)
For i=0 To licol.Size-1
    Log(licol.GetKeyAt(i) & " - " & licol.GetValueAt(i))
Next

end sub

I can have the Keys but the app returns 'null' for each Value, knowing that the array of the getting action is in a Map (seen in different forums).
The table is correctly filled with values.

Here is a result :

id - null
date - null
fournisseur - null
ville - null
affectation - null
montant - null
numfacture - null
modepaiement - null
numcheque - null
comptepayeur - null
titulaire - null
sousaffectation - null
note - null
codebarres - null
an - null
null
mois - null
jour - null

How to solve it ? Did I forgot something ?
Is it a problem of type ?
 

Mahares

Expert
Licensed User
Longtime User
How to solve it ? Did I forgot something ?
Is it a problem of type ?
Your code looks correct, although using GetKeyAt is depracated. But that is not a problem
Your problem is somewhere else. If you put a small project together, one of the members will spot it.
You can try this way, Normally, this is the proper way, but it does the same thing as what you had:
B4X:
Dim licol As Map = B4XTable1.GetRow(RowId)
For Each s As String In licol.Keys
        Log($"key: ${s}    Value: ${licol.Get(s)}"$)
    Next
 
Upvote 1

DALB

Active Member
Licensed User
Hi, deleting this line at:

activity_resume:
Sub Activity_Resume
    'chargerB4Xtable ' RE-Load the B4XTable with datas.
End Sub

solves the problem.
A mistake from me.
Thanks everyone.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
did you mean that you deleted the whole sub?
Hi Shelby: No I don't think he deleted the whole sub. I don;t want to speak for the OP, but what he did was comment the call to the sub called: chargerB4Xtable in Activity_Resume. If the OP disagrees, he will of course give you his take on it.
 
Upvote 0

DALB

Active Member
Licensed User
Mahares, you are right !
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…