以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]统计汇总  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=130121)

--  作者:一只田鸡
--  发布时间:2019/1/14 9:08:00
--  [求助]统计汇总
请教各位老师,

如果我想根据开奖号码分布列,统计各种排列出现的次数,该怎么设置汇总模式,或者怎么写按钮代码呀
统计结果按次数从多到少排列。


图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看
[此贴子已经被作者于2019/1/14 9:33:09编辑过]

--  作者:有点甜
--  发布时间:2019/1/14 9:43:00
--  

参考

 

Dim ls As new List(Of String)
Dim dt As Table = Tables("表A")
For Each dc As Col In dt.Cols
    If dc.Caption.StartsWith("第") Then
        ls.add(dc.name)
    End If
Next
Dim ary1(ls.count-1) As Double
Dim ary2 = ls.ToArray
For i As Integer = 0 To ary2.length-1
    ary1(i) = dt.compute("count(_Identify)", ary2(i) & " is not null")
Next
array.sort(ary1, ary2)
For i As Integer = 0 To ary2.length-1
    dt.Cols(ary2(i)).Move(0)
Next


--  作者:一只田鸡
--  发布时间:2019/1/14 9:54:00
--  
请问老师 这些代码有案例吗
--  作者:一只田鸡
--  发布时间:2019/1/14 10:12:00
--  
以下是引用有点甜在2019/1/14 9:43:00的发言:

参考

 

Dim ls As new List(Of String)
Dim dt As Table = Tables("表A")
For Each dc As Col In dt.Cols
    If dc.Caption.StartsWith("第") Then
        ls.add(dc.name)
    End If
Next
Dim ary1(ls.count-1) As Double
Dim ary2 = ls.ToArray
For i As Integer = 0 To ary2.length-1
    ary1(i) = dt.compute("count(_Identify)", ary2(i) & " is not null")
Next
array.sort(ary1, ary2)
For i As Integer = 0 To ary2.length-1
    dt.Cols(ary2(i)).Move(0)
Next


有点看不懂,甜老师能不能给个例子 或者 帮忙修改一下呀图片点击可在新窗口打开查看,先谢谢老师。

比如说,点击按钮后,显示 1 2 4 7 10出现次数:1 

   1 2 4 5 8 出现次数:1

......

[此贴子已经被作者于2019/1/14 10:17:39编辑过]

--  作者:有点甜
--  发布时间:2019/1/14 10:35:00
--  
上传具体项目测试。
--  作者:一只田鸡
--  发布时间:2019/1/14 10:46:00
--  
以下是引用有点甜在2019/1/14 10:35:00的发言:
上传具体项目测试。
好的老师。
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:11选5新.foxdb

[此贴子已经被作者于2019/1/14 14:28:23编辑过]

--  作者:有点甜
--  发布时间:2019/1/14 11:08:00
--  

这个意思?

 

Dim ls As new List(Of String)
Dim dt As Table = Tables("information")
For Each dc As Col In dt.Cols
    If dc.Caption.StartsWith("开奖号码分布_") Then
        ls.add(dc.name)
    End If
Next
Dim ary1(ls.count-1) As Double
Dim ary2 = ls.ToArray
For i As Integer = 0 To ary2.length-1
    ary1(i) = dt.compute("count(_Identify)", ary2(i) & " is not null")
Next
array.sort(ary1, ary2)
For i As Integer = 0 To ary2.length-1
    dt.Cols(ary2(i)).Move(6)
Next


--  作者:有点甜
--  发布时间:2019/1/14 11:21:00
--  

这个意思?

 

Dim dt As Table = Tables("information")
Dim dic As new Dictionary(of String, Integer)
For Each r As Row In dt.Rows
    Dim ary() As String = {r("开奖号码_A"),r("开奖号码_B"), r("开奖号码_C"), r("开奖号码_D"), r("开奖号码_E")}
    array.sort(ary)
    Dim str = String.Join(",", ary)
    If dic.ContainsKey(str) = False Then
        dic.Add(str, 1)
    Else
        dic(str) += 1
    End If
Next
Dim ary1(dic.Keys.count-1) As String
Dim ary2(dic.Keys.count-1) As Integer
Dim i As Integer = 0
For Each key As String In dic.Keys
    ary1(i) = key
    ary2(i) = dic(key)
    i += 1
Next
array.sort(ary2, ary1)
For i = ary2.length-1 To 0 Step -1
    output.show(ary1(i) & ":" & ary2(i))
Next


--  作者:一只田鸡
--  发布时间:2019/1/14 11:39:00
--  
以下是引用有点甜在2019/1/14 11:21:00的发言:

这个意思?

 

Dim dt As Table = Tables("information")
Dim dic As new Dictionary(of String, Integer)
For Each r As Row In dt.Rows
    Dim ary() As String = {r("开奖号码_A"),r("开奖号码_B"), r("开奖号码_C"), r("开奖号码_D"), r("开奖号码_E")}
    array.sort(ary)
    Dim str = String.Join(",", ary)
    If dic.ContainsKey(str) = False Then
        dic.Add(str, 1)
    Else
        dic(str) += 1
    End If
Next
Dim ary1(dic.Keys.count-1) As String
Dim ary2(dic.Keys.count-1) As Integer
Dim i As Integer = 0
For Each key As String In dic.Keys
    ary1(i) = key
    ary2(i) = dic(key)
    i += 1
Next
array.sort(ary2, ary1)
For i = ary2.length-1 To 0 Step -1
    output.show(ary1(i) & ":" & ary2(i))
Next


上面代码我在本机运行,没反应。


其实就是像下图,我想统计出开奖号码分布列(11列)里各种组合出现的次数,

比如下图,统计结果就是:

1 2 3 4 5 出现4次,

2 3 4 5 6出现2次,

1 2 7 8 9出现1次


图片点击可在新窗口打开查看此主题相关图片如下:2.png
图片点击可在新窗口打开查看


--  作者:有点甜
--  发布时间:2019/1/14 11:50:00
--  

output.show,显示在命令窗口里面的

 

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