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()
myTDConnection.DisconnectProject
myTDConnection.ReleaseConnection
Set myTDConnection = Nothing
End Sub
”””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””’
Sub Cleanruns(DeleteTheDraftRunsOlderthanxDays)

On Error Resume Next

Myinterval=date – DeleteTheDraftRunsOlderthanxDays
VarYear= DatePart(“yyyy”, Myinterval)
VarMonth=DatePart(“m”,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:RN_DRAFT,LogicalFilter:y,VisualFilter:y,NO_CASE:}”&_
“{TableName:RUN,ColumnName:\00000011\RN_EXECUTION_DATE,LogicalFilter:””<” & GetInterval & “””,NO_CASE:}”&_
“{TableName:RUN,ColumnName:RN_RUN_NAME,LogicalFilter:*QoT_Offl*,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)
Next
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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s