Update Run fields for runs created in Quality of Things(QoT)

This article provides a sample script to update run fields for runs created in QoT

 

‘************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

TheRunFilter = “[Filter]”&_
“{TableName:RUN,ColumnName:RN_DRAFT,LogicalFilter:N,NO_CASE:}”&_
“{TableName:RUN,ColumnName:RN_RUN_NAME,LogicalFilter:*QoT_Onl*,NO_CASE:}”

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 UpdateRuns(RunFieldToUpdate,RunValueToUpdate)
On Error Resume Next
Set runf = myTDConnection.RunFactory
Set runList = runf.Newlist(TheRunFilter)

LResponse = MsgBox(“Are you sure to want to update ” & runList.count & ” runs?”, 308, “Please confirm”)
If LResponse = vbYes Then
For Each Item In runList
Item.field(RunFieldToUpdate)=RunValueToUpdate
Item.post
Next

End If

Set runList = Nothing
Set runf = Nothing
End Sub

”””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””’
Sub Main()
Call Initialize
Call LoginAlm
‘Example Call UpdateRuns(“RN_STATE”,”Finished”). it will update the run Field State with the value “Finished”
Call UpdateRuns(“”,””)
Call logoutALm
MsgBox “Update 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