设置逻辑列的格式:http://www.foxtable.com/webhelp/scr/1306.htm
Select Case e.DataCol.Name
Case "方向","交易金额"
Dim drs As List(of DataRow)
Dim Filter As String
Filter = "[_Identify] >= " & e.DataRow("_Identify") & " And [方向] = '" & e.DataRow("方向") & "'"
drs = e.DataTable.Select(Filter)
For i As Integer = 0 To drs.Count - 1
Dim dr = drs(i)
If i = drs.Count - 1 Then
Filter = "[_Identify] <= " & dr("_Identify") & " And [方向] = '" & dr("方向") & "'"
Dim Val1 As Double = e.DataTable.Compute("Sum(交易金额)",Filter)
dr("余额") = Val1
Else
dr("余额") = Nothing
End If
Next
If e.DataCol.Name = "方向" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then
Filter = "[_Identify] > " & e.DataRow("_Identify") & " And [方向] = '" & e.OldValue & "'"
drs = e.DataTable.Select(Filter)
For i As Integer = 0 To drs.Count - 1
Dim dr = drs(i)
If i = drs.Count - 1 Then
Filter = "[_Identify] <= " & dr("_Identify") & " And [方向] = '" & dr("方向") & "'"
Dim Val1 As Double = e.DataTable.Compute("Sum(交易金额)",Filter)
dr("余额") = Val1
Else
dr("余额") = Nothing
End If
Next
End If
End Select