Foxtable(狐表)用户栏目专家坐堂 → [求助]拆分字符串后再转换成二维表。


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

主题:[求助]拆分字符串后再转换成二维表。

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


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

按什么规则拆分?

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


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

Dim dictCol As new Dictionary(of String,Integer)
Dim r As Row = Tables("表B").Rows(0)
For i As Integer = 1 To Tables("表B").Cols.Count - 1
    dictCol.Add(r(i),i)
Next

Dim dictRow As new Dictionary(of String,Integer)
For i As Integer = 1 To Tables("表B").Rows.Count - 1
    dictRow.Add(Tables("表B").Rows(i)("第一列"),i)
Next

For Each r1 As Row In Tables("表A").Rows
    If r1.IsNull("编码") = False
        Dim ss() As String = r1("编码").split("/")
        If ss.length = 1 Then
            Tables("表B").Rows(dictRow(ss(0)))(1) = r1("数量")
        Else
            Tables("表B").Rows(dictRow(ss(1)))(dictCol(ss(0))) = r1("数量")
        End If
    End If
Next

 回到顶部