How to delete Quality of Things(QoT) unused runs

This article provides a sample script on how to delete Quality of Things unused runs.


‘**********Global Variables**********
Dim myurl
Dim mydomain
Dim myproject
Dim myTDConnection
Dim myuser
Dim mypwd
Dim TheRunFilter
Sub Initialize()
myurl = “http://Server:8080/qcbin” ‘ToUpdate
mydomain = “mydomain” ‘ToUpdate
myproject = “myproject” ‘ToUpdate
myuser = “qot” ‘ToUpdate
mypwd = “pwd” ‘ToUpdate
End Sub

Sub LoginAlm()
Set myTDConnection = CreateObject(“tdapiole80.tdconnection”)
myTDConnection.initconnection myurl
myTDConnection.ConnectProjectEx mydomain, myproject, myuser, mypwd
End Sub
Sub logoutALm()
Set myTDConnection = Nothing
End Sub
Sub Cleanruns(DeleteTheDraftRunsOlderthanxDays)

On Error Resume Next

Myinterval=date – DeleteTheDraftRunsOlderthanxDays
VarYear= DatePart(“yyyy”, Myinterval)
Varday=DatePart(“d”, Myinterval)
If Len(Varday)=1 Then Varday=”0″ & Varday
If Len(VarMonth)=1 Then VarMonth=”0″ & VarMonth
GetInterval=VarYear & “-” & VarMonth & “-” & Varday
TheRunFilter = “[Filter]”&_
“{TableName:RUN,ColumnName:\00000011\RN_EXECUTION_DATE,LogicalFilter:””<” & GetInterval & “””,NO_CASE:}”&_

Set runf = myTDConnection.RunFactory
Set runList = runf.Newlist(TheRunFilter)

LResponse = MsgBox(“Are you sure to want to delete ” & runList.count & ” runs?”, 308, “Please confirm”)

If LResponse = vbYes Then
For Each Item In runList
runf.RemoveItem (Item.ID)
End If

Set runList = Nothing
Set runf = Nothing
End Sub

Sub Main()
Call Initialize
Call LoginAlm
‘Example Call Cleanruns(300). it will delete the QoT Drafts runs older than 300 days
Call Cleanruns()
Call logoutALm
MsgBox “Runs Deletion Done”
End Sub
Call main

READ  Cannot add HTTPS Performance Center URL in Application Lifecycle Management LAB Management

Leave a Comment