Foxtable(狐表)用户栏目专家坐堂 → [求助]表格结构转换


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

主题:[求助]表格结构转换

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


加好友 发短信
等级:超级版主 帖子:521 积分:4910 威望:0 精华:7 注册:2008/9/2 22:22:00
  发帖心情 Post By:2013/6/19 18:26:00 [显示全部帖子]

Dim v1 As New List(of String)
v1.AddRange(DataTables("表A").GetComboListString("日期","","日期").split("|"))
Dim sql,s1 As String
For n1 As Integer =1 To v1.count
    SQL+=" ,Max(考勤)  As A" &  n1
Next
SQL="Select 姓名" & SQL & "  From{表A}  Group by 姓名"

Dim dtb As New DataTableBuilder("统计")
dtb.Build()

With DataTables("统计")
    .StopRedraw
    .Fill(SQL,True)
    For Each c As Col In Tables("统计").Cols
        If c.Index > 0 Then
            .DataCols(c.name).Caption = Format(Cdate(v1(c.Index -1)),"yyyy-MM-dd")
            .BuildHeader()
        End If
    Next
    
    For Each r As Row In Tables("统计").Rows
        For Each c As Col In Tables("统计").Cols
            If c.Index > 0 Then
                r(c.name) = DataTables("表A").Find("姓名 = '" & r("姓名") & "' And 日期 =#" & c.Caption & "#")("考勤")
            End If
        Next
    Next
    MainTable= Tables("统计")
    .ResumeRedraw
End With


 回到顶部