Foxtable(狐表)用户栏目专家坐堂 → [求助]为什么可以计算,但是会卡很久?


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

主题:[求助]为什么可以计算,但是会卡很久?

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/6/12 8:50:00 [显示全部帖子]

1、不要重置列,如果需要全部重新计算,参考

 

http://www.foxtable.com/webhelp/scr/2219.htm

 

2、如果自己不会调试,上传具体实例测试。


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/6/12 9:34:00 [显示全部帖子]

1、代码

 

Dim dr As DataRow = e.DataRow
Dim dt As DataTable = DataTables("销售开单")
If e.DataCol.Name = "编号" Then
    Dim ary1() = {"AA","BB","CC","DD","EE","FF","GG","HH","II","JJ","KK","LL"}
    Dim ary2(ary1.length) As Date
    Dim d As Date = Date.today
    d = new Date(d.year, d.month, 1)
    ary2(0) = d
    For i As Integer = 0 To ary1.length-1
        ary2(i+1) = d.AddMonths(-i-1)
    Next
    Dim ary3(ary1.length-1) As Double
    Dim drs = dt.Select("[编号] = '" & dr("编号") & "'", "日期 desc")
    For Each cdr As DataRow In drs
        For i As Integer = 0 To ary1.length-1
            If cdr("日期") >= ary2(i+1) AndAlso cdr("日期") < ary2(i) Then
                ary3(i) += cdr("数量")
                Exit For
            End If
        Next
    Next
    For i As Integer = 0 To ary1.length-1
        dr(ary1(i)) = ary3(i)
    Next
End If

 

2、代码

 

If MainTable.Name = "计算" Then
    systemready = False
    Dim f As New Filler
    DataTables("计算").DataRows.Clear() '清除原有数据
    f.SourceTable = DataTables("销售开单")
    f.SourceCols = "编号"
    f.DataTable = DataTables("计算")
    f.DataCols = "编号"
    f.Fill()
    systemready = True
    DataTables("计算").datacols("编号").RaiseDataColChanged
End If


 回到顶部