Get the release cycles that match a filter
Public Sub FindCycles()

' Get the release cycles that match a filter

Dim FieldName$
Dim CycFilterStr$

Dim aFilter As TDFilter
Dim listOfCycles As List
Dim cyc As cycle
Dim cycFactory As CycleFactory

    ' tdc is the TDConnection object.
    ' To search through all release cycles in the project,
    ' get the cycle factory from TDConnection.
    Set cycFactory = tdc.CycleFactory
    
    ' To search only in the cycles of a specific release,
    ' get the cycle factory from the Release object.
    ' For example,
    'Set cycFactory = TheReleaseObj.CycleFactory
    
    
    ' Get the  Filter from cycleFactory
    ' and set the field and the filter string.
    Set aFilter = cycFactory.Filter
    FieldName = "RCYC_HAS_ATTACHMENTS"
    CycFilterStr = "Y"
    aFilter.Filter(FieldName) = CycFilterStr
    
    ' Get the list of matching release cycles.
    Set listOfCycles = aFilter.NewList
    ' Extract the Cycle names.
    For Each cyc In listOfCycles
        Debug.Print cyc.Name
    Next
    
    ' Get the complementary list.
    CycFilterStr = "NOT Y"
    aFilter.Filter(FieldName) = CycFilterStr
    Set listOfCycles = aFilter.NewList
    ' Extract the Cycle names.
    For Each cyc In listOfCycles
        Debug.Print cyc.Name
    Next
    
    Set aFilter = Nothing
    Set listOfCycles = Nothing
    Set cyc = Nothing
    Set cycFactory = Nothing

End Sub