Hi,
how can I read the 'values' of a tableview with labels ?
tried this, can't get the label
how can I read the 'values' of a tableview with labels ?
B4X:
Sub fill_tableview(inn As Map, name As String)
Private ti AsTreeItem
ti.Initialize("ti", name)
If inn.Size > 0 Then
Private s AsInt
For s = 0 To inn.Size - 1
Private a AsString
Dim number As Label
number.Initialize("")
number.Text = xd
number.Style = get_style(name)
Dim tname As Label
tname.Initialize("")
tname.Text = inn.GetKeyAt(s)
tname.Style = get_style(name)
Dim tvalue As Label
tvalue.Initialize("")
tvalue.Text = inn.GetValueAt(s)
tvalue.Style = get_style(name)
TableView1.Items.add(Array As Object(number, tname, tvalue))
' Private cti As TreeItem
' If inn.GetKeyAt(s) <> "" And inn.GetValueAt(s)<>"" Then
' cti.Initialize("ti",inn.GetKeyAt(s)&" = " & inn.GetValueAt(s) )
' ti.Children.Add(cti) 'add the child
' EndIf
xd = xd + 1
Next
TreeView1.Root.Children.Add(ti) 'add the father to the root
AutoSizeTableCols(TableView1, 5, 120)
EndIf
EndSub
tried this, can't get the label
B4X:
Sub exportToCSV(tv As TableView, foldername As String, filename As String)
Log(tv)
AppLog("exportTableViewToCSV Start")
Private su AsStringUtils
Private l AsList
l.Initialize
Private item() As Object = Array As Object(TextField1.Text, DateTime.Date(DateTime.Now) & "|" & DateTime.Time(DateTime.Now),"description")
For y = 0 To tv.Items.Size - 1
tv.SelectedRow = y
Private OldRow() As Object = tv.SelectedRowValues
Private NewRow(Row.Length) As String
For x = 0 To OldRow - 1
Log(Row(x))
NewRow(x) = OldRow(x)
Next
l.Add(NewRow)
Next
Try
su.SaveCSV2(foldername, filename, ", ", l, item)
Catch
Dlg.ErrorDialog("Error", "Error saving dat file " & filename, LastException.Message)
Log("exportTableViewToCSV " & LastException)
EndTry
EndSub