Foxtable(狐表)用户栏目专家坐堂 → 多人合作的统计表问题


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

主题:多人合作的统计表问题

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


加好友 发短信
等级:超级版主 帖子:106178 积分:540007 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/7/9 9:07:00 [显示全部帖子]

和这里的用法基本差不多的http://foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=147418&skin=0

Dim dtb As New DataTableBuilder("统计")
dtb.AddDef("姓名", Gettype(String), 32)
dtb.AddDef("嘉奖", Gettype(Double))
dtb.Build()

Dim lst As new List(of String)
lst.AddRange({"曹操","刘备","孙权"})

Dim dict As new Dictionary(of String,Double)
Dim lst2 As new List(of String) '记录其中是管理层的人
For Each r As Row In Tables("表A").Rows
    For Each s As String In r("姓名").split(",")
        If lst.Contains(s) Then lst2.Add(s)
    Next
    Dim fy As Double = r("嘉奖") / lst2.Count '按管理层人数平分
    For Each s As String In lst2
        If dict.ContainsKey(s) Then
            dict(s) = dict(s) + fy
        Else
            dict.Add(s,fy)
        End If
    Next
Next
Dim dr,d2 As DataRow
For Each key As String In dict.Keys
    dr = DataTables("统计").AddNew
    dr("姓名") = key
    dr("嘉奖") = dict(key)
Next


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


加好友 发短信
等级:超级版主 帖子:106178 积分:540007 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/7/9 13:58:00 [显示全部帖子]

……
Dim dict As new Dictionary(of String,Double)
Dim lst2 As new List(of String) '记录其中是管理层的人
For Each r As Row In Tables("表A").Rows
    lst2.Clear
    For Each s As String In r("姓名").split(",")
        If lst.Contains(s) Then lst2.Add(s)
    Next
……

 回到顶部