这样好理解一些,结合了二楼的代码:
If e.DataCol.name="天数" OrElse e.DataCol.name="面试室" Then
If e.DataRow.IsNull("天数")=False AndAlso e.DataRow.IsNull("面试室")=False Then
Dim drs As List(Of DataRow) = DataTables("笔试成绩").Select("天数='" & e.DataRow("天数") & "' and 面试室='" & e.DataRow("面试室") & "'", "总成绩 desc")
e.DataRow("最高分") = DataTables("笔试成绩").Compute("max(总成绩)","天数='" & e.DataRow("天数") & "' and 面试室='" & e.DataRow("面试室") & "'")
e.DataRow("最低分") = DataTables("笔试成绩").Compute("min(总成绩)","天数='" & e.DataRow("天数") & "' and 面试室='" & e.DataRow("面试室") & "'")
e.DataRow("总分") = DataTables("笔试成绩").Compute("sum(总成绩)","天数='" & e.DataRow("天数") & "' and 面试室='" & e.DataRow("面试室") & "'")-e.DataRow("最高分")-e.DataRow("最低分")
Dim maxid As Integer = DataTables("笔试成绩").FInd("天数='" & e.DataRow("天数") & "' and 面试室='" & e.DataRow("面试室") & "'","总成绩 desc")("_IDentify")
Dim minid As Integer = DataTables("笔试成绩").FInd("天数='" & e.DataRow("天数") & "' and 面试室='" & e.DataRow("面试室") & "'","总成绩")("_IDentify")
e.DataRow("面试室平均值")= (e.DataRow("总分") - drs(0)("总成绩") - drs(1)("总成绩")- drs(drs.count -1)("总成绩")) - drs(drs.count -2)("总成绩"))/ (drs.count -4)
e.DataRow("计数") = DataTables("笔试成绩").Compute("Count(总成绩)","天数='" & e.DataRow("天数") & "' and 面试室='" & e.DataRow("面试室") & "'")
e.DataRow("加权平均值") = e.DataTable.Compute("avg(面试室平均值)","天数='" & e.DataRow("天数") & "' and 是否加权='" & e.DataRow("是否加权") & "'" )
e.DataRow("加权系数") = e.DataRow("加权平均值")/e.DataRow("面试室平均值")
End If
End If
[此贴子已经被作者于2015/5/21 10:12:51编辑过]