Page tree

You can write code that reads values from job info sheets.

To find the latest job info sheet:

' InSite stores the multiple versions of the JobInfoSheet in the Control
file Dir
Dim JobInfoSheetHome As String =
System.IO.Path.Combine(triggerEvent.Job.JobHome, _
"Control\VersionedJobInformationSheets")
' Get a string array with the directory names of all the versioned
JobInfoSheets
Dim VerInfoSheets As String() =
System.IO.Directory.GetDirectories(JobInfoSheetHome)
' The directory names are date and time (for example,
2005.06.29.15.29.43), so sort them
Array.Sort(VerInfoSheets)
' The most recent JobInfoSheet should be in the last folder of the sorted
array
Dim LatestInfoSheet As String = _
System.IO.Path.Combine(VerInfoSheets(VerInfoSheets.Length -1),
"JobInfoSheet.xml")


To read values from a job info sheet:

' Create an XML document object
Dim myXmlDocument As System.Xml.XmlDataDocument = New
System.Xml.XmlDataDocument
' Load the object with the XML file
myXmlDocument.Load(xmlFile)
' Search for the first node in the document that matches an Xpath query
Dim node As System.Xml.XmlNode = myXmlDocument.SelectSingleNode("/JobSpec/
JobOnSpoke")
' If the search was successful, copy the XML node contents into a string
Dim myXmlResult As String = Nothing
If (Not node Is Nothing) Then
myXmlResult = node.InnerText.Trim()
End If

  • No labels