Sub SortPayment
Dim Result,sizeIndex As String
Dim Cursor1 As Cursor
'#table1 - express/seniors
'#table2 - ordinary line
Dim table1,table2 As List
table1.Initialize:table2.Initialize
'del = DBUtils.ExecuteMap(SQL, "SELECT qp ,status FROM Quep",Null)
Cursor1 = SQL.ExecQuery("SELECT qp ,status FROM Quep") '' Query from Table
sizeIndex = Cursor1.RowCount '' indetify the size of records from table
For i = 0 To Cursor1.RowCount - 1 '' Iterate all records
Cursor1.Position = i '' Get Cursor position
Result = Cursor1.GetString("qp") '' Get values in column qp
'Msgbox(Cursor1.GetString("qp") ,"Total " & sizeIndex) '' Display in Messagebox
If Result.Contains("S") Then '' Test if it contains specific value within the item
'SenrCtr = SenrCtr + 1
table1.Add(Result)
Else '' Identify number of Seniority in the table
table2.add(Result)
End If
Next
''--------------------------------------------------------------
'EMPTY CONTENT OF TABLE
DBUtils.ExecuteMap(SQL, "DELETE from Quep",Null)
''--------------------------------------------------------------
table1.Sort(True)
For i=0 To table1.Size-1
Log(table1.Get(i) & " Got it here1")
DBUtils.ExecuteMap(SQL, "Insert into Quep(qp,status)values('" & table1.Get(i) & "',0) ",Null)
Next
For i=0 To table2.Size-1
Log(table2.Get(i) &" Got it here2")
DBUtils.ExecuteMap(SQL, "Insert into Quep(qp,status)values('" & table2.Get(i) & "',0) ",Null)
Next
End Sub