我有一个包含许多记录的列表,我想根据条件提取记录,如果条件满足,那么我需要将满足条件的记录添加到新列表中。
下面是我写到现在的代码:
Module Module2
Sub Main()
Dim td
td = CreateObject("TDApiOle80.TDConnection")
td.InitConnectionEx("http://qc10dev/qcbin")
'Note: For Quality Center, connect by using the URL below:
'td.InitConnectionEx "http://<servername>:port/qcbin"
td.ConnectProjectEx("DEFAULT", "GPS_PROGRAM", "PQRST", "XYX@123")
Dim tsfact 'As TDAPIOLELib.TestSetFactory
Dim tslist 'As TDAPIOLELib.List
'Getting Random Test Set ID
'************************ACCESS ALL THE TEST SETS ******************************************************************** '
tsfact = td.TestSetFactory
tslist = tsfact.NewList("")
'************************GET THE COUNT OF TEST SETS ******************************************************************
Dim Count_Of_TestSets
Count_Of_TestSets = tslist.Count
Console.WriteLine("Count of Test Sets" + Count_Of_TestSets.ToString)
'************************GET A RANDOM TEST SET INDEX ***************************************************************
Dim TestSetID As Integer
Dim TestSetName = Nothing
Dim SerialNumber As Integer = 0
Dim AttachmentPresent
Dim tslist_Having_Attachments = Nothing
For Each TestSet In tslist
TestSetID = TestSet.ID
TestSetName = TestSet.Name
'Console.WriteLine("TestSet ID::" + TestSetID.ToString() + "Test Set Name" + TestSetName)
AttachmentPresent = TestSet.HasAttachment()
If StrComp(AttachmentPresent, "True") = 0 Then
Console.WriteLine("TestSet ID::" + TestSetID.ToString() + "Test Set Name" + TestSetName)
End If
Next
Console.WriteLine("Logic Completed, Press enter")
Console.ReadLine()
tslist = Nothing
tsfact = Nothing
td = Nothing
End Sub
端模块
如果您浏览上面的代码,则基本列表是 tslist。
从这个曾经记录满足条件的tslistStrComp(AttachmentPresent, "True") = 0
必须添加到新列表中说 tslist_attachment。
如何创建新列表并添加值?
请告诉我步骤,。
问候, 斯里哈里