TD缺陷统计——Excel辅助导出

上一篇 / 下一篇  2008-12-18 13:11:27 / 个人分类:TD

       此功能主要是收集我们自定义过滤条件的BUG列表,根据这个功能,我们可以开发很多我们的需求。

 

Function Defects_ActionCanExecute(ActionName)

 On Error Resume Next

 

 IF ActionName="changelist" then

 

    Dim i, j

    Dim a(300,300)

    Dim status

    msg1="请输入想过滤的状态,','号为分隔符"

    Title="状态选择"

    status = InputBox(msg1,Title)

    b = split(status,",")

    Set xlApp = CreateObject("Excel.Application")

    xlApp.Visible = True

    Set xlBook = xlApp.Workbooks.Open("D:\test1.xls")

    Set xlsheet = xlBook.Worksheets(1)

    xlsheet.Activate

 

   set com = TDConnection.Command

   dim str

   if ubound(b) = 0 then

   str = "'"&status&"'"

   else

      for i=0 to ubound(b)

         if i<>ubound(b) then

            str = str&"'"&b(i)&"'"&","

            else

            str = str&"'"&b(i)&"'"

         end if

      next

end if

 

'com.CommandText = "SELECT BG_BUG_ID,BG_STATUS,BG_DETECTED_BY,BG_PROJECT,BG_SUMMARY FROM BUG where convert(varchar(70),bg_bug_id) in (select distinct hs_key from history where convert(char(10),hs_change_date,120) = convert(char(10),getdate(),120) and hs_table_name = 'bug' and hs_new_value = '"&status&"')"

   com.CommandText = "SELECT BG_BUG_ID,BG_DETECTION_DATE,BG_RESPONSIBLE,BG_CYCLE_REFERENCE,BG_SEVERITY,BG_STATUS,BG_SUMMARY FROM BUG where BG_STATUS in("&str&")"

   'com.CommandText = "SELECT BG_BUG_ID,BG_STATUS,BG_PROJECT,BG_SUMMARY FROM BUG where convert(varchar(70),bg_bug_id) in (select distinct hs_key from history where convert(char(10),hs_change_date,120) = convert(char(10),'2008-07-25',120) and hs_table_name = 'bug' and hs_new_value ='"&status&"')"

   Set RecSet = com.Execute

 

   a(1,1)="问题编号"

   a(1,2)="提交时间"

   a(1,3)="提交给"

   a(1,4)="所属模块"

   a(1,5)="严重级别"

   a(1,6)="受理状态"

   a(1,7)="SUMMARY"

 

 for i = 2 to RecSet.RecordCount

    for j = 0 to 6

     a(i,j+1)=RecSet(j)

    next

    RecSet.Next

 next

 

 for i=1 to RecSet.RecordCount

    for j=1 to 7

         xlsheet.Cells(i,j) = a(i,j)

    next

 next

 

    xlBook.RunAutoMacros (xlAutoOpen)

    cmDialog.CancelError = False

    cmDialog.FileName = "BUG REPORT"

    cmDialog.DialogTitle = "Save Export File"

    cmDialog.DefaultExt = "*.xls"

    strFileName = cmDialog.FileName

    Set ōbjFileSystem = CreateObject("scrīpting.FileSystemObject")

    msg = MsgBox("成功导出!", vbOKOnly)

    end if

 Defects_ActionCanExecute = Project_DefaultRes

 On Error GoTo 0

End Function


TAG: TD

 

评分:0

我来说两句

Open Toolbar