以文本方式查看主题

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

--  作者:blsu33
--  发布时间:2015/12/29 13:28:00
--  [求助]统计数据
老师,

DataTables("合成_table2").DataRows.Clear
DataTables("合成_table1").Save
For Each dr As DataRow In DataTables("合成_table1").dataRows
    If dr.IsNull("第一列")=True Then
        dr.Delete                                                                            ‘去除空值
    End If
Next

Dim fh As WinForm.TextBox = e.Form.Controls("TextBox1")                                                             ‘指定连接符号
Dim len As WinForm.NumericComboBox = e.Form.Controls("NumericComboBox1")                                  ’指定每行多少个
Dim ns() As String
Dim bt,bt1 As String
Dim i,i1 As Integer
Dim len1 As Integer
\'len1=DataTables("合成_table1").Compute("Count([第一列])", "第一列 <> \' \'")

If fh.Text<>"" AndAlso len.Value >0 AndAlso DataTables("合成_table1") IsNot Nothing Then
    For Each dr As DataRow In DataTables("合成_table1").dataRows
        If dr.IsNull("第一列")=False Then
            bt &= "," & dr("第一列")                                                                                    ’和成字符串,例如 1,2,3,4,5,
        Else
            MessageBox.Show("请填写要合成的code!")
            Exit For
        End If
    Next
    If bt.Length>0 Then
        ns=bt.SubString(1).split(",")
        For i=0 To ns.Length-1 Step 14 \'len.Value
            ’bt1 &=bt1 & ns(i)
            Tables("合成_table2").AddNew()
            Tables("合成_table2").Current("第一列")=bt.TrimStart(",").SubString(i,len.Value)                       ‘想要生成表的每一行,这块怎么写呢
        Next
    End If
Else

--  作者:blsu33
--  发布时间:2015/12/29 13:31:00
--  

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

--  作者:大红袍
--  发布时间:2015/12/29 14:22:00
--  

这个意思?

 

Dim pr As Row = Nothing
For i As Integer = 0 To Tables("表A").rows.count - 1
    If i Mod 3 = 0 Then
        If pr IsNot Nothing Then pr("第一列") = pr("第一列").trim(",")
        pr = Tables("表B").AddNew()
    End If
    pr("第一列") &= Tables("表A").rows(i)("第一列")& ","
Next
If pr IsNot Nothing Then pr("第一列") = pr("第一列").trim(",")


--  作者:blsu33
--  发布时间:2015/12/29 18:01:00
--  
哦 是这个意思老师
但是提示未应用到对象,麻烦您再给看下

Dim fh As WinForm.TextBox = e.Form.Controls("TextBox1")
Dim len As WinForm.NumericComboBox = e.Form.Controls("NumericComboBox1")‘假如一行14个
Dim pr As Row = Nothing
For i As Integer = 0 To Tables("合成_table1").rows.count - 1
    If i Mod len.Value-1 = 0 Then                                                                ’取余为0的 是一行正好14个的
        If pr IsNot Nothing Then
            pr("第一列") = pr("第一列").trim(",")                                                     
            pr = Tables("合成_table2").AddNew()                                               ‘增加一行,并赋值
            pr= Nothing                                                                                、重新开始
        End If
        pr("第一列") &= Tables("合成_table1").rows(i)("第一列")& ","                       ’在pr= Nothing 的重新开始基础上,重新累加
    End If
Next
If pr IsNot Nothing Then
    pr("第一列") = pr("第一列").trim(",")
pr = Tables("合成_table2").AddNew()                                                            ‘最后一次计算的不能取余的部分,增加一行
End If
[此贴子已经被作者于2015/12/29 18:17:53编辑过]

--  作者:大红袍
--  发布时间:2015/12/29 18:17:00
--  

Dim fh As WinForm.TextBox = e.Form.Controls("TextBox1")
Dim len As WinForm.NumericComboBox = e.Form.Controls("NumericComboBox1")
Dim pr As Row = Nothing
For i As Integer = 0 To Tables("合成_table1").rows.count - 1
    If i Mod len.Value-1 = 0 Then
        If pr IsNot Nothing Then
            pr("第一列") = pr("第一列").trim(",")
           
        End If
        pr = Tables("合成_table2").AddNew()
    End If
    pr("第一列") &= Tables("合成_table1").rows(i)("第一列")& ","
Next
If pr IsNot Nothing Then
    pr("第一列") = pr("第一列").trim(",")
End If