The use of Filter is very useful if you need to analyze a very high number of elements of the same type. It is useful also for Prject with lots of data.
Suppose you need to analyze defects according to a specific field value.
To do this you could retrieve a list of all defects or filter it. Let's see how to use the filter.
For this example the field on which create the filter is BG_USER_01 and the value that we're looking for is "Very Urgent"
1. We need to retrieve the TDFilter object of the BugFactory
set objBugFilter = TDConnection.BugFactory.Filter
2. Let's set the Filter
objBugFilter.Filter("BG_USER_01") = "Very Urgent"
3. Extract of the List
set objListBug = objBugFilter.NewList
At the end objListBug is the filtered List according to the Filter (BG_USER_01 = "Very Urgent"). So now you can do the standard for cycle (for each...) to analyze all the element of the list.
Another example to set a filter on the Test Name. Suppose to have some Test with the Name that starts with "Test Number " + a progressive number (ex: "Test Number 001", "Test Number 002",..., "Test Number N") and we want to retrieve all of them. As we did in the previous example we:
1. Create TDFilter object of the TestFactory
set objTestFilter = TDConnection.TestFactory.Filter
2. Set the Filter
objTestFilter.Filter("TS_NAME") = "Test*Number*"
or
objTestFilter.Filter("TS_NAME") = """Test Number*"""
Note: To set a filter based on the name when there are space chars insert the "*" char instead of intermediate spaces or put the string between quote.
3. Estrazione della lista
set objListTest = objTestFilter.NewList
Now you get the list of all Test whose names start with "Test Number*".
Questo sito è stato realizzato con Jimdo! Registra il tuo sito gratis su https://it.jimdo.com