以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  表计算BUG反馈  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=102920)

--  作者:nblwar
--  发布时间:2017/6/27 17:36:00
--  表计算BUG反馈



第一列为备注型,第二列为双精度小数

备注型中输入以下字符串

600458,,600462,,006396,,017333,,600759,,017141,,600763,,600764,,600765,,006284,,013377,,013376,,013375,,006404,,006791,,006383,,012355,,010524,,010537,,014653,,006392,,006384,,006385,,006386,,006388,,006282,,006281,,017255,

选中第一列和第二列

执行一下代码
Output.Show(CurrentTable.Aggregate(Foxtable.AggregateEnum.Sum, CurrentTable.TopRow, CurrentTable.LeftCol, CurrentTable.BottomRow, CurrentTable.RightCol))


报错

---------------------------
版本:2017.6.12.1
---------------------------
代码执行出错,错误信息:



System.OverflowException: 值对于 Decimal 太大或太小。

   在 System.Decimal..ctor(Double value)

   在 #s5.#6mb.#5mb(Object #Pu)

   在 #s5.#2fb.Aggregate(AggregateEnum #gc, CellRange #Ccb, AggregateFlags #pC)

   在 C1.Win.C1FlexGrid.C1FlexGridBase.Aggregate(AggregateEnum aggType, CellRange rg, AggregateFlags flags)

   在 C1.Win.C1FlexGrid.C1FlexGridBase.Aggregate(AggregateEnum aggType, Int32 topRow, Int32 leftCol, Int32 bottomRow, Int32 rightCol, AggregateFlags flags)

   在 Foxtable.Table.Aggregate(AggregateEnum AggregateType, Int32 R1, Int32 C1, Int32 R2, Int32 C2)

   在 UserCode.Test()
---------------------------
确定   
---------------------------



--  作者:有点色
--  发布时间:2017/6/27 18:59: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