Move requirements and set the order
Public Sub MoveReqs()

' Move requirements and set the order

    Dim rqFactory As ReqFactory
    Set rqFactory = tdc.ReqFactory
    
' This sample code shows the effect of different orderings
' when using ReqFactory.MoveRequirements.
'
' The initial state of the data is:
'  |- Folder Req(1)
'  |-- Child Req (3)
'  |-- Child Req (4)
'  |-- Child Req (5)
'  |-- Child Req (6)
'  |- Folder Req(2)
    
    
'------------------------------------------------
' This call places each Req in a specific position.
    rqFactory.MoveRequirements "5, 4, 3", _
        "1, 2, 3", _
        2
        
    Debug.Assert False
' After refreshing the display, the state of the data is:
'  |- Folder Req(1)
'  |-- Child Req (6)
'  |- Folder Req(2)
'  |-- Child Req (5)
'  |-- Child Req (4)
'  |-- Child Req (3)

'------------------------------------------------
' This call appends the Reqs to the end of the
' existing children of the new parent, preserving
' the order of the list of requirements by placing
' each Req last, in its turn.
    Const last = tagTDAPI_POS_ORDER.TDPOSITION_LAST
    Dim order As String
    order = CStr(last) & "," & CStr(last) & "," & CStr(last)
    
    rqFactory.MoveRequirements "3, 5, 4", _
       order, _
        1
    
    Debug.Assert False

' After refreshing the display, the state of the data is:
'  |- Folder Req(1)
'  |-- Child Req (6)
'  |-- Child Req (3)
'  |-- Child Req (5)
'  |-- Child Req (4)
'  |- Folder Req(2)


'------------------------------------------------
' This call adds the Reqs to the beginning of the
' existing children of the new parent, inverting
' the order of the list of requirements by placing
' each Req first. As each Req is placed first, the
' others are moved down.
    rqFactory.MoveRequirements "3, 4, 5", _
        "1, 1 , 1", _
        2
        
    Debug.Assert False
' After refreshing the display, the state of the data is:
'  |- Folder Req(1)
'  |-- Child Req (6)
'  |- Folder Req(2)
'  |-- Child Req (5)
'  |-- Child Req (4)
'  |-- Child Req (3)

'------------------------------------------------
' This call adds the Reqs to the beginning of the
' existing children of the new parent. The first is
' place first, then the second is placed second.
' When the third is also placed second, the previous
' second moves down one.
' The Req that was already under the parent becomes last.
    rqFactory.MoveRequirements "3, 4, 5", _
        "1, 2 , 2", _
        1
   Debug.Assert False
' After refreshing the display, the state of the data is:
'  |- Folder Req(1)
'  |-- Child Req (3)
'  |-- Child Req (5)
'  |-- Child Req (4)
'  |-- Child Req (6)
'  |- Folder Req(2)
    
End Sub