Foxtable(狐表)用户栏目专家坐堂 → 求解示例文件中的表达式


  共有11286人关注过本帖树形打印复制链接

主题:求解示例文件中的表达式

帅哥哟,离线,有人找我吗?
chan1997
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:40 积分:376 威望:0 精华:0 注册:2012/1/3 17:14:00
求解示例文件中的表达式  发帖心情 Post By:2012/1/3 21:08:00 [显示全部帖子]

 

 求解示例文件中“流水账”演示文件的表达式

 

那位高手哪在每句后面给加上注解,让我这新手能更容易加深理解

 

 

 

 

 

 例子二_DataColChanged

 

Select Case e.DataCol.Name

    Case "产品","入库","出库"

        Dim drs As List(of DataRow)

        Dim Filter As String

        Filter = "[_SortKey] >= " & e.DataRow("_SortKey") & " And [产品] = '" & e.DataRow("产品") & "'"

        drs = e.DataTable.Select(Filter)

        For Each dr As DataRow In drs

            Filter = "[_SortKey] <= " & dr("_SortKey") & " And [产品] = '" & dr("产品") & "'"

            Dim Val1 As Double = e.DataTable.Compute("Sum(入库)",Filter)

            Dim Val2 As Double = e.DataTable.Compute("Sum(出库)",Filter)

            dr("库存") = Val1 - Val2

        Next

        If e.DataCol.Name = "产品" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then

            Filter = "[_SortKey] > " & e.DataRow("_SortKey") & " And [产品] = '" & e.OldValue & "'"

            drs = e.DataTable.Select(Filter)

            For Each dr As DataRow In drs

                Filter = "[_SortKey] <= " & dr("_SortKey") & " And [产品] = '" & dr("产品") & "'"

                Dim Val1 As Double = e.DataTable.Compute("Sum(入库)",Filter)

                Dim Val2 As Double = e.DataTable.Compute("Sum(出库)",Filter)

                dr("库存") = Val1 - Val2

            Next

        End If

End Select

 

例子二_DataRowDeleting

 

e.DataRow("入库") = 0

e.DataRow("出库") = 0

 

例子二_AfterMoveRow

 

Dim Key As Decimal

Dim Index As Integer

Dim Filter As String

Dim r As Row

Index = Math.Min(e.OldIndex, e.NewIndex)

Key = e.Table.Rows(Index)("_SortKey")

r = e.Table.Rows(e.NewIndex)

Filter = "[_SortKey] >= " & Key & " And [产品] = '" & r("产品") & "'"

e.Table.DataTable.DataCols("入库").RaiseDataColChanged(Filter)


 回到顶部