[Link] [Link] [Link] [Link] [Link] rce/ [Link] [Link] rce/ [Link] [Link] [Link]
html Re: Export QTP DataTable on QC Resources Module Options 03-25-2011 08:11 AM I, too, could not find any built-in functionality for that. I wrote a function t hat will do what you ask, but only if the data table source in test settings is a test resource in the Test Resources module in ALM/QC. You need to implement Fi le_GetTempFolder() or replace the call with inline code. Kevin Function Alm_ExportAssociatedDataTable: export the datatable to a ALM/Quality ' Center test resource that is associated with the current test ' Parameters: N/A ' Returns: Boolean, true if successful ' TODO: expand to also support exporting to other types of data tables sources ' datatablepath can also refer to an attachment in ALM/Quality Center or local f ile Function Alm_ExportAssociatedDataTable ' As Boolean Dim qtApp ' As [Link] Dim aDTPathParts ' As Array of String Dim sResourcePath ' As String Dim sResourceName ' As String Dim otaRFFact ' As [Link] Dim otaResFolder ' As [Link] Dim otaResourceFactory ' As [Link] Dim otaResource ' As [Link] Dim otaResourceList ' As [Link] Collection Dim otaResourceFilter ' As [Link] Dim aFolders ' As Array of String Dim otaTDC ' As [Link] Dim sTempFolder ' As String Dim oFSO ' As [Link] Dim i, j Alm_ExportAssociatedDataTable = False Set otaTDC = [Link] Set qtApp = CreateObject("[Link]") ' DataTablePath looks like the following when it is a test resoruce so split it up '"[QC-RESOURCE];;Resources\Data Tables;;\Example" aDTPathParts = Split([Link], ";;") If UBound(aDTPathParts) <> 2 Or aDTPathParts(0) <> "[QC-RESOURCE]" Then ' DataTa blePath is not a test resource Exit Function
End If sResourcePath = aDTPathParts(1) sResourceName = aDTPathParts(2) ' trim leading \ if present If Left(sResourceName, 1) = "\" Then sResourceName = Right(sResourceName, Len(sR esourceName) - 1) ' need to get the id of the parent folder that contains the data table resorce s o ' we can filter later using the ParentId Set otaRFFact = [Link] Set otaResFolder = [Link] ' the QCResourceFolder Object implements ISysTreeNode2 Interface but does not im plement ' FindChildNode so navigate the resources tree manually... aFolders = Split(sResourcePath, "\") For i = 0 To UBound(aFolders) If Len(aFolders(i)) >0 Then ' skip over empty strings caused by leading/trailing "\"s as well as multiple "\"s For j = 1 To [Link] ' iterate over the sub-folders If [Link](j).Type = 10 And [Link](j).Name = aFolders(i) Then Set otaResFolder = [Link](j) Exit For End If Next End If Next Set otaResourceFactory = [Link] Set otaResourceFilter = [Link] [Link]("RSC_PARENT_ID") = [Link] [Link]("RSC_NAME") = "'" & sResourceName & "'" Set otaResourceList = [Link]() If [Link] = 1 Then Set otaResource = [Link](1) sTempFolder = File_GetTempFolder() [Link] sTempFolder & "\" & [Link] [Link] [Link] sTempFolder, True Alm_ExportAssociatedDataTable = True Set oFSO = CreateObject("[Link]") [Link](sTempFolder & "\" & [Link]) End If End Function ' Alm_ExportAssociatedDataTable [Link] [Link]