以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  再求做表  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=69905)

--  作者:青岛hhh
--  发布时间:2015/6/12 15:53:00
--  再求做表

大红袍老师您好!

麻烦你再帮我看看

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1_201506121440.zip

1.统计“数据1”,“数据2”两个不同结构的数据表。
2.逐条记录统计,一条记录中当某个“指标N”小于等于0时,哪些指标大于0。

3.在“汇总”表汇总大于0指标的个数:第一列是等于0的指标名称,从第二列列名是”数据1“和“数据2”的列名(指标1-N),数据是汇总指标N等于0时,其他各指标大于0的个数。

[此贴子已经被作者于2015/6/12 16:13:57编辑过]

--  作者:大红袍
--  发布时间:2015/6/12 16:32:00
--  
 看不懂你说什么
--  作者:大红袍
--  发布时间:2015/6/12 16:46:00
--  

Dim tbs() As String = {"数据1", "数据2"}
Dim cs1() As String = {"指标1", "指标2", "指标3"}
Dim cs2() As String = {"指标4", "指标5", "指标6"}
Dim ls As new List(Of String())
ls.Add(cs1)
ls.add(cs2)

For i As Integer = 0 To tbs.Length - 1
    Dim cs As String() = ls(i)
    For Each r As Row In Tables(tbs(i)).rows
        Dim fdr As DataRow = DataTables("汇总").Find("指标项 = \'" & r("名称") & "\'")
        If fdr Is Nothing Then
            fdr = DataTables("汇总").AddNew
            fdr("指标项") = r("名称")
        End If
        For j As Integer = 0 To cs.Length - 1
            fdr(Tables("汇总").Cols(j+1).Name) += iif(r(cs(j))>0, 1, 0)
        Next
    Next
Next


--  作者:青岛hhh
--  发布时间:2015/6/12 17:12:00
--  

统计当\'指标N‘=0时,其他各指标不等于0的次数,如: 

                                                       数据表        

                                                                                指标1   指标2   指标3

                                                                   记录1         5         0        -2

                                                                   记录2         0         3          1

                                                                   记录3         0       8          0

                                                                   记录4        

 

                                                汇总到汇总表

                                                                                 指标1   指标2   指标3

                                                                     指标2         1                           (记录1:指标2=0时,指标1大于0)

                                                                     指标1                  2          1      (记录2:指标1=0时,指标2大于0,指标,3大于0,

                                                                                                                     记录 3:指标1=0时,指标2大于0)

 

                                                                     指标3                  1                   (记录3:指标3=0时,指标2大于0)

 

 

 

 

 


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

Dim tbs() As String = {"数据1", "数据2"}
Dim cs1() As String = {"指标1", "指标2", "指标3"}
Dim cs2() As String = {"指标4", "指标5", "指标6"}
Dim ls As new List(Of String())
ls.Add(cs1)
ls.add(cs2)

For i As Integer = 0 To tbs.Length - 1
    Dim cs As String() = ls(i)
    For Each r As Row In Tables(tbs(i)).rows
       
        For j As Integer = 0 To cs.Length - 1
            If r(cs(j)) = 0 Then
                Dim fdr As DataRow = DataTables("汇总").Find("指标项 = \'" & cs(j) & "\'")
               
                If fdr Is Nothing Then
                    fdr = DataTables("汇总").AddNew
                    fdr("指标项") = cs(j)
                End If
                For k As Integer = 0 To cs.Length - 1
                    If r(cs(k)) > 0 Then
                        fdr(Tables("汇总").Cols(k+1).Name) += 1
                    End If
                Next
            End If
        Next
    Next
Next


--  作者:青岛hhh
--  发布时间:2015/6/16 11:35:00
--  

汇总表缺"指标4", "指标5", "指标6"列,且统计指标汇总到"指标1", "指标2", "指标3"里了,


要求:汇总表的指标列=数据1的指标列+数据2的指标列,统计数据分别汇总到各列,汇总后列=行。

 

请老师再帮我修改一下代码。


--  作者:大红袍
--  发布时间:2015/6/16 12:20:00
--  

 那你就加入对应的列啊

 

Dim tbs() As String = {"数据1", "数据2"}
Dim cs1() As String = {"指标1", "指标2", "指标3"}
Dim cs2() As String = {"指标4", "指标5", "指标6"}
Dim ls As new List(Of String())
ls.Add(cs1)
ls.add(cs2)

For i As Integer = 0 To tbs.Length - 1
    Dim cs As String() = ls(i)
    For Each r As Row In Tables(tbs(i)).rows
       
        For j As Integer = 0 To cs.Length - 1
            If r(cs(j)) = 0 Then
                Dim fdr As DataRow = DataTables("汇总").Find("指标项 = \'" & cs(j) & "\'")
               
                If fdr Is Nothing Then
                    fdr = DataTables("汇总").AddNew
                    fdr("指标项") = cs(j)
                End If
                For k As Integer = 0 To cs.Length - 1
                    If r(cs(k)) > 0 Then
                        fdr(cs(k)) += 1
                    End If
                Next
            End If
        Next
    Next
Next


--  作者:青岛hhh
--  发布时间:2015/6/17 16:49:00
--  
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1_201506171643.zip

汇总表"指标4", "指标5", "指标6"列的统计指标汇总到"指标1", "指标2", "指标3"里了
--  作者:大红袍
--  发布时间:2015/6/17 18:59:00
--  
 看7楼,不会。
--  作者:青岛hhh
--  发布时间:2015/6/23 11:16:00
--  
7楼会了,代码运行通过,由于数据量太大,我想改一下只做数据1汇总,自己改了代码不行,还要请老师帮忙。