Android Question Sample code for Updaterow() from Table Class

slavko

Member
Licensed User
Longtime User
Hi,

i am trying to find any kind of sample for UpdateRow from Table class. Through the Search i got only 3 matches, that i can find out, what a proper sintax is.

What i am trying to do , is, to update a table created from csv and than save back to file.

Are there any samples?

THX, Slavko
 

slavko

Member
Licensed User
Longtime User
You need to define an array of the column values and call UpdateRow.
B4X:
Dim Values() As String
Values = Array As String (ValCol1, ValCol2, etc)
Table1.UpdateRow(RowIndex, Values)


it is working now, thx, Slavko
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Three possibilities:
1. define a string array with all the values in the row with the new value for the given col.

2. Add this routine in the class code.
B4X:
' update a cell in the table
' col is the columne index and row is the row index of the cell to update, Value is the cell content string
' return true if worked out, false if failed
Public Sub UpdateCell(Col As Int, Row As Int, Value As String) As Boolean
    If (Col < 0 Or Col > mNumberOfColumns - 1 Or Row < 0 Or Row>Data.Size-1) Then
        Return False
    End If
    SetValue(Col, Row, Value)
    Return True
End Sub

3. Download version 2.25, which contains the UpdateCell routine.
 
Upvote 0
Top