I have a LIST which contains many record's, I want to extract records based on a condition and if the condition satisfies then I need to add the condition satisfied record into a new list.
Below is the code which I have written till now:
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
End Module
If you go through the above code the base List is tslist.
From this tslist which ever records has satisfied condition StrComp(AttachmentPresent, "True") = 0
has to be added to New list say tslist_attachment.
How can create a new list and add the values?
Please let me know the steps,.
Regards, Srihari