Sub Activity_Create(FirstTime As Boolean)
'create second tableview
Dim table2 As Table
table2.Initialize(Me, "Table1", 5 ,Gravity.CENTER,True)
table2.AddToActivity(Activity, 200%x, 0dip, 100%x, 50%y)'the x is set bigger than the activity wight because i dont want to see the table view, its just for sorting
table2.clearall
table2.SetHeader(Array As String("Col1", "Col2", "Col3", "Col4","Col5"))
end sub
Sub sorter
Table2.ClearAll
Table1.sortTable(4,True) 'first sort the table1 with all his items negative and positive
Dim lastpos As Int 'want to start from the last item
lastpos = (Table1.Size - 1)
For i = 0 To Table1.Size - 1
If Table1.GetValue(4,lastpos - i) >= 0 Then
table2.AddRow(Array As String(Table1.GetValue(0,i),Table1.GetValue(1,i),Table1.GetValue(2,i),Table1.GetValue(3,i),Table1.GetValue(4,i)))' add all positive numbers to table2
Table1.RemoveRow(lastpos - i)
End If
Next
'now we have all negative numbers in table1 and all positive in table2
Table1.sortTable(4,False)'sort dec
table2.sorttable(4,True)
For i = 0 To table2.Size - 1
Table1.AddRow(Array As String(table2.GetValue(0,i),table2.GetValue(1,i),table2.GetValue(2,i),table2.GetValue(3,i),table2.GetValue(4,i)))
Next
End Sub