Dim ls As new List(Of String)
Dim dt As Table = Tables("sp表")
For Each dc As Col In dt.Cols
If dc.Caption.StartsWith("p") Then
ls.add(dc.name)
End If
Next
Dim ary1(ls.count-1) As Double
Dim ary2 = ls.ToArray
For i As Integer = 0 To ary2.length-1
ary1(i) = dt.Compute("sum(" & ary2(i) & ")")
Next
array.sort(ary1, ary2)
For i As Integer = 0 To ary2.length-1
Tables("sp表").Cols(ary2(i)).Move(1)
Next
Tables("sp表").sort = "得分 desc"
Dim rs As Integer = Tables("sp表").count
For j As Integer = 0 To ary2.length-1 '有没有问题?
Dim sum1 = 0
Dim sum2 = 0
For i As Integer = 0 To rs-1
If ary1(j) > i Then 'p线上方0的学生得分和
If Tables("sp表").Rows(i)(ary2(j)) = 0 Then
sum1 += Tables("sp表").Rows(i)("得分")
End If
Else
If Tables("sp表").Rows(i)(ary2(j)) = 1 Then
sum2 += Tables("sp表").Rows(i)("得分")
End If
End If
Next
output.show(sum1 & " " & sum2)
Next