Foxtable(狐表)用户栏目专家坐堂 → 统计列字符合并为一行


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

主题:统计列字符合并为一行

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


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/8/29 17:36:00 [显示全部帖子]

只能用代码处理
Dim first As String = Tables("表A").Rows(0)("第一列")
Dim s As String = Tables("表A").Rows(0)("第二列")
Dim count = 1
For i As Integer = 1 To Tables("表A").Rows.count - 1
    If Tables("表A").Rows(i)("第一列") = first Then
        s &= "," & Tables("表A").Rows(i)("第二列")
        count += 1
    Else
        Dim dr As Row = Tables("表B").AddNew
        dr("第一列") = first
        dr("第二列") = count
        dr("第三列") = s

        first = Tables("表A").Rows(i)("第一列")
        s = Tables("表A").Rows(i)("第二列")
        count = 1
    End If
    
Next
Dim dr2 As Row = Tables("表B").AddNew
dr2("第一列") = first
dr2("第二列") = count
dr2("第三列") = s


 回到顶部