Foxtable(狐表)用户栏目专家坐堂 → 窗口中的table 这两个的数据如何做到自动求和


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

主题:窗口中的table 这两个的数据如何做到自动求和

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


加好友 发短信
等级:幼狐 帖子:115 积分:1014 威望:0 精华:0 注册:2014/11/3 20:24:00
窗口中的table 这两个的数据如何做到自动求和  发帖心情 Post By:2016/3/13 23:04:00 [只看该作者]

窗口中的table 这两个的数据如何做到自动求和  类似于这样 
 
图片点击可在新窗口打开查看此主题相关图片如下:qq图片20160313225827.png
图片点击可在新窗口打开查看

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


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/3/14 10:50:00 [只看该作者]


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


加好友 发短信
等级:幼狐 帖子:115 积分:1014 威望:0 精华:0 注册:2014/11/3 20:24:00
  发帖心情 Post By:2016/3/14 13:34:00 [只看该作者]


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20160314133043.jpg
图片点击可在新窗口打开查看

用这个后  选择字符型的 列的数字后 出现死循环  怎么破?

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


加好友 发短信
等级:幼狐 帖子:115 积分:1014 威望:0 精华:0 注册:2014/11/3 20:24:00
  发帖心情 Post By:2016/3/14 13:49:00 [只看该作者]

写到系统SystemIdle事件

 

Dim str1 As String = ""
Dim t As Table = CurrentTable

Str1 = Str1 & "计数:" & t.Aggregate(AggregateEnum.Count, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
Str1 = Str1 & "累计:" & t.Aggregate(AggregateEnum.Sum, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
Str1 = Str1 & "平均:" & t.Aggregate(AggregateEnum.Average, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
Str1 = Str1 & "最大:" & t.Aggregate(AggregateEnum.Max, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
Str1 = Str1 & "最小:" & t.Aggregate(AggregateEnum.Min, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
Str1 = Str1 & "标准差:" & t.Aggregate(AggregateEnum.Std, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
Str1 = Str1 & "总体标准差:" & t.Aggregate(AggregateEnum.StdPop, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
Str1 = Str1 & "方差:" & t.Aggregate(AggregateEnum.Var, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
Str1 = Str1 & "总体方差:" & t.Aggregate(AggregateEnum.VarPop, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "


StatusBar.Message3 = str1


用这个方法后 出现这样的 


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/3/14 16:36:00 [只看该作者]

 你的值太大照成的, 尽量不要统计字符列,不然会报错

 

Dim str1 As String = ""
Dim t As Table = CurrentTable
Dim hadString As Boolean = False
For i As Integer = t.LeftCol To t.RightCol
    If t.cols(i).IsString Then
        hadString = True
        Exit For
    End If
Next
Str1 = Str1 & "计数:" & t.Aggregate(AggregateEnum.Count, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
If hadString = False Then
    Str1 = Str1 & "累计:" & t.Aggregate(AggregateEnum.Sum, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "平均:" & t.Aggregate(AggregateEnum.Average, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "最大:" & t.Aggregate(AggregateEnum.Max, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "最小:" & t.Aggregate(AggregateEnum.Min, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "标准差:" & t.Aggregate(AggregateEnum.Std, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "总体标准差:" & t.Aggregate(AggregateEnum.StdPop, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "方差:" & t.Aggregate(AggregateEnum.Var, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "总体方差:" & t.Aggregate(AggregateEnum.VarPop, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
End If

StatusBar.Message3 = str1


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


加好友 发短信
等级:幼狐 帖子:115 积分:1014 威望:0 精华:0 注册:2014/11/3 20:24:00
  发帖心情 Post By:2016/3/14 17:32:00 [只看该作者]

您这个代码  还是 报错   我这样修改了一下   测试 可用 不会报错 
If CurrentTable.Cols(CurrentTable.ColSel).IsNumeric Then
Dim str1 As String = ""
Dim t As Table = CurrentTable
Str1 = Str1 & "计数:" & t.Aggregate(AggregateEnum.Count, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
Str1 = Str1 & "累计:" & t.Aggregate(AggregateEnum.Sum, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
Str1 = Str1 & "平均:" & t.Aggregate(AggregateEnum.Average, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
'Str1 = Str1 & "最大:" & t.Aggregate(AggregateEnum.Max, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
'Str1 = Str1 & "最小:" & t.Aggregate(AggregateEnum.Min, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
'Str1 = Str1 & "标准差:" & t.Aggregate(AggregateEnum.Std, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
'Str1 = Str1 & "总体标准差:" & t.Aggregate(AggregateEnum.StdPop, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
'Str1 = Str1 & "方差:" & t.Aggregate(AggregateEnum.Var, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
'Str1 = Str1 & "总体方差:" & t.Aggregate(AggregateEnum.VarPop, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
StatusBar.Message3 = str1

Else
Dim str1 As String = "非数值型,无法统计"
StatusBar.Message3 = str1
End If

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/3/14 17:40:00 [只看该作者]

 5楼代码我测试没问题,当然,能用就好。

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


加好友 发短信
等级:四尾狐 帖子:995 积分:6712 威望:0 精华:0 注册:2015/1/12 22:12:00
  发帖心情 Post By:2016/9/14 15:24:00 [只看该作者]

Str1 = Str1 & "计数:" & t.Aggregate(AggregateEnum.Count, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "

上面代码放在判断语句外还是出错,放在判断语句内就不出错了,但“计数”就统计不出来了

 回到顶部
帅哥,在线噢!
有点蓝
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106689 积分:542640 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/9/14 15:33:00 [只看该作者]

上例子说明

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


加好友 发短信
等级:四尾狐 帖子:995 积分:6712 威望:0 精华:0 注册:2015/1/12 22:12:00
  发帖心情 Post By:2016/9/14 17:16:00 [只看该作者]

Dim str1 As String = ""
Dim t As Table = CurrentTable
Dim hadString As Boolean = False
For i As Integer = t.LeftCol To t.RightCol
    If t.cols(i).IsString Then
        hadString = True
        Exit For
    End If
Next
Str1 = Str1 & "计数:" & t.Aggregate(AggregateEnum.Count, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
If hadString = False Then
    Str1 = Str1 & "累计:" & t.Aggregate(AggregateEnum.Sum, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "平均:" & t.Aggregate(AggregateEnum.Average, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "最大:" & t.Aggregate(AggregateEnum.Max, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "最小:" & t.Aggregate(AggregateEnum.Min, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "标准差:" & t.Aggregate(AggregateEnum.Std, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "总体标准差:" & t.Aggregate(AggregateEnum.StdPop, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "方差:" & t.Aggregate(AggregateEnum.Var, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "总体方差:" & t.Aggregate(AggregateEnum.VarPop, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
End If

StatusBar.Message3 = str1


上面代码运行会出错

用下代码就不出错

Dim str1 As String = ""
Dim t As Table = CurrentTable
Dim hadString As Boolean = False
For i As Integer = t.LeftCol To t.RightCol
    If t.cols(i).IsString Then
        hadString = True
        Exit For
    End If
Next
‘Str1 = Str1 & "计数:" & t.Aggregate(AggregateEnum.Count, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
If hadString = False Then

    Str1 = Str1 & "计数:" & t.Aggregate(AggregateEnum.Count, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "累计:" & t.Aggregate(AggregateEnum.Sum, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "

    Str1 = Str1 & "平均:" & t.Aggregate(AggregateEnum.Average, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "最大:" & t.Aggregate(AggregateEnum.Max, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "最小:" & t.Aggregate(AggregateEnum.Min, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "标准差:" & t.Aggregate(AggregateEnum.Std, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "总体标准差:" & t.Aggregate(AggregateEnum.StdPop, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "方差:" & t.Aggregate(AggregateEnum.Var, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    Str1 = Str1 & "总体方差:" & t.Aggregate(AggregateEnum.VarPop, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
End If

StatusBar.Message3 = str1




 回到顶部
总数 11 1 2 下一页