Summary

If a job makes use of Job Variables, it may be useful to have a record of the values of those variables when the job executed. This information can be used for verifying that variables are being set correctly or for troubleshooting job problems.

This article describes how to use a script to record this information in the Job Log.

More Information

To log the variable information, you can create a Shared Script that can then be called from any job for which you want to report the variable values.

Creating the Script

1. In the adTempus Console, expand the Scripts node, then right-click the Shared Scripts node and select the New Shared Script command.

2. In the Script Properties, name the script "Log Job Variables" (or whatever name you prefer). Make sure the Language is set to "VB.NET". Delete the existing script code and paste in the following code:

Imports System
Imports System.Collections
Imports ArcanaDevelopment.adTempus.Server

Public Class UserScript
    Inherits ArcanaDevelopment.adTempus.ScriptEngine.UserScriptBase

    Public Overrides Function Run() As Object
		Dim variableList As New System.Text.StringBuilder
		
		For i As Integer=0 To adTempus.JobVariables.Count-1
			variableList.AppendLine(adTempus.JobVariables.Key(i) & "=" & adTempus.JobVariables(i))
		Next

        adtempus.LogMessage(MessageTypeEnum.Informational, 0, "Current job variables : " & System.Environment.NewLine & variableList.ToString())

        Return 0
    End Function
End Class

3. Click OK to save the script.

Using the Script

The new Shared Script can be run by a Response any time you want to report the current values of the variables defined for a job.

For example, if you want to list the variables at the end of a job or step:

  1. In the job (or step) properties, go to the Responses page and click Add.
  2. In the Response Properties window, click the Add button in the Events section.
  3. In the Response Event Properties window, select the "End of Job" (or "Step Ends") event, then click OK.
  4. Click the Add button in the Actions section.
  5. Select the "Execute a script" action and click OK.
  6. Select the Select button under Script to Execute, then select the script you created earlier.
  7. Click OK to return to the Response Properties, then OK again to return to the job (or step) properties.

Status

Beginning with version 4, adTempus logs the values of all job variables to the Job Detail Log.