AMT Help Files
homeLION Language ReferenceSyntaxTask ObjectJob Interface

Job Interface

The Job Interface object is returned by the CreateJob function that is provided through the Task Object Connection interface. Through this object, the functionality of the Job utility can be used.

The following functionality is provided:

Properties

Name  Type Access Description
AlternativeReportName String Read/Write An alternative report name can be set to use for the Batch Controller. In this way the report used can be run more than once simultaneous even if this has been disabled in the Job Queue settings.
AppName String Read/Write When set it defines the application to look for jobs in the functions AddJobRequest(<JobName>) and JobIdByJobName(<JobName>). This property may be set to a different application than used when connecting the ComScript Module to an application.
Note: When set to a non existent application the write will fail, the value will be left unchanged and the properties ErrorCode and ErrorDescription will be set accordingly.
BatchId Integer Read/Write When set to zero before and AddJobRequest() it will reflect the JobId as shown in the Job list of the Control Center after the call to AddJobRequest(). If set to a non zero value it will remain unchanged.
DeadlockPriority Integer Read/Write When two processes try to lock the same record, the process that comes second will fail with a deadlock error. When using an MSSQL Database server this property can be set to a value ranging from -10 to 10 (default 0). When the values set for both processes differ, the process with the lowest value will fail, even when it was the first to lock the record. info Note: For MSSQL Server only.  
Debug Boolean Read/Write When set to True the report will start in debug mode. I.e. the report will wait after startup for the debugger to connect to it enabling debugging of the report.
ErrorCode Integer Readonly Reads the error code of the Job Object. The code will be zero if there was no error. This code is only valid if the property Wait was set to 'TRUE'.
ErrorDescription String Readonly Reads the error description of the Job Object. If there was no error 'OK' is returned. This description will only be valid if the property Wait was set to 'TRUE'.
FileName String Read/Write Should be set to the executable (.exe or .wsf) version of the report to start by the call to AddJobRequest. The absolute path or UNC path to this executable should be used.
Globalparameter String Read/Write Can be used to pass global parameters to the report. The called report can read this information using SI-PARAM in the main logic.
InitialResult Integer Read/Write Initial value for the system variable SI-REPORTRESULT at start of the report.
JobId  Integer Readonly This property is set to the Id number or a job as shown in the Joblist in the Control Center after returning from the call to AddJobRequest().
JobName String Read/Write When not set previously this property will be set to the name of the executed job after returning form the call to AddJobRequest(). Otherwise it will be left unchanged.
JobState Interger Readonly If, before starting the report, the property Wait has been set to True, upon return this property will contain the exit state of the executed report. If Wait has been set to False the return state will be Undefined.
JobText String Read/Write A free to choose text to use inside the script.
Language String Read/Write The language to use if the report is Multilanguage. It will be copied to the system variable SI-LANGUAGE inside the report.
MaximumNumberOfRestarts Integer Read/Write Gets or sets the maximum number of retries after a job crashes. The default number of restarts is 5.
ProcessId Integer Readonly The Windows ProcessId of the running job.
ProcessJobId Integer Readonly Returns the Process job id.
ProcessOk Boolean Read/Write If AddJobRequest was called with the Wait property set to TRUE, this property will be set to True if the called job exited with no error. If Wait was set to False the return value will always be  False.
QueueName String Read/Write In this property the name of the batch queue to place this job in can be set. When no queue is specified, the queue defined at the job will be used, as shown in the Available Jobs list of the Control Center. Will be set to the name of the queue used when the job is running.
RecoverCriticalReport Boolean Read/Write Can be set to True to recover a crashed report that uses the SAVERECOVERY option.
ReportParameter String Read/Write If inside the report a special report parameter is defined this property can be used to pass information to this parameter. The maximum size of this parameter is 1024 characters.
RequestId Integer Readonly After return from the call to AddJobRequest this property is set to the id of the request used in the AMT system.
RunAs String Read/Write The batch controller will retrieve the specified user from the LoginAccounts and use the specified credentials for the start of the job. The job will then run under those credentials.
If the account is not found/disabled it will fail to start the report.
RunInsideBatchController Integer Read/Write Whether to override the 'Run inside Batchcontroller' setting in the Job Queue. Possible values:
  • 0: default, use the setting in the Job Queue
  • 1: report will run as separate process
  • 2: report will run inside the Batchcontroller process
Running Boolean Readonly Returns true when the current job is in the running state.
ScriptParameter String Read/Write If the job to execute is a script, this property can be used to pass parameters to the script. 
StartDate String Read/Write The date to execute the job in the format CCYYMMDD.
StartedDateTime String Readonly The date-time when the job was started by the batchcontroller in the format CCYYMMDDhhmmssnnn. 
StartTime  String Read/Write The time to execute the job in the format HHMM.
Station String Read/Write The name of the initiating station of the job to use in the logfiles.
SysParam String Read/Write Can be used to pass system parameters to the report.
TaskString String Readonly An XML string used to pass the TaskValue and custom Task Values to and from a report or script.  
TaskValue String Read/Write A value that is passed to and from a report or script. Note: To return the TaskValue to the calling report or script the function SaveTaskValue() should be invoked in the called report or script after changing the value of TaskValue. 
TraceFileMessages String Read/Write The name of the trace file to write a copy of all messages (SME) to.
When the file already exists the messages will be appended.
When a relative file name is used the file will be created in the logfile folder of the AMT environment.
Note: The files are created and written directly by the report itself (i.e. not through the filecontroller). They will not be removed automatically by the batchcontroller.
User String Read/Write Name of the user to use in the logging for this job.
UserGroup String Read/Write Defines the user group name. This name has to be specified case sensitive, otherwise the report will not be shown in the Job Management tabsheet of AMT Screens. The job will always be visible in the Job Management option of the Control Center.
Wait Boolean Read/Write When set to True the function AddJobRequest will wait for the job to finish before returning to the script. If set to False, the job request will just be placed in batch queue and return to the script immediately. When setting Wait to True it is wise to also set WaitTimeout to detect hanging of the report. Default is True (wait for the job to finish).
WaitTimeout Integer Read/Write When the Wait property has been set to True, this property can be used to create a timeout in case the execution time of the report is much longer than expected. In the properties ErrorCode and ErrorDescription is then visible that a timeout occurred.

Functions

Function Name  Return type  Parameters  Description 
Name  Type
AddAcceptFile Void FileName String Adds an acceptfile to use for request of the report.
AddBackupDir Void PrintId String Sets the backup directory for the printer settings of PrintId. When a backup directory is set the FormId setting will be overwritten.
BackupDir String
AddBannerIdFile Void PrintId String Adds a Banner file to the printer settings of PrintId. BannerFile should be given as absolute path/filename combination.
BannerFile String
AddDefaultBackupDir Void BackupDir String Sets the backup directory for the default print settings. The FormId setting will be overwritten. 
AddDefaultBanner Void BannerFile String Adds a Banner file to the default printer settings. Should be given as an absolute path/filename combination.
AddDefaultFormId Void FormId String Adds a FormId to the default printer settings. When set the printfiles will be placed in a subdirectory named <FormId> within the prints directory. This setting will be overwritten when a Backup directory is set.
AddDefaultNumberOfCopies Void NrCopies Integer Adds the number of copies to print to the default printer settings.
AddDefaultPrinter Void Printer String Adds a printer to the default printer settings.
AddDefaultPrintFileName Void Filename String Adds the print filename to the default printer settings.
AddDefaultPrintSetting Void PrintFile String This function sets default print settings for the default printer with PrintId PROUT. These settings will be used as defaults when a Print object is created. Some can be overwritten inside the Print object.
Printer String
DontPrint Boolean
NumofCopies Integer
PrintBanner Boolean
NoDateSubDir Boolean
AddExtractFile Void Filename String Sets the initial filename of the extract file to use for the given File-Id. This can be altered inside the report. The file created will be kept after execution of the report started by the job object.
File-Id String
AddExtractRetainFile Void Filename String Sets the initial filename of the extract file to use for the given File-Id. This can be altered inside the report. When RetainFile is set to True the file created will be kept after execution of the report started by the job object, otherwise it will be deleted automatically.
File-Id String
RetainFile Boolean
AddFormId Void PrintId String Adds a FormId to the printer settings of PrintId. When set the printfiles will be placed in a subdirectory named <FormId> within the print directory. This setting is overwritten when a Backup directory is set.
FormId String
AddJobRequest Integer JobName String

Adds a job request for the job given in JobName. Upon success the RequestId is returned otherwise -1. The job in JobName has to be a job in the application set in the AppName property of the Job Class. JobType describes the type of job, available types are: Script, Batch, Report and Executable.

The optional ProcessJobId parameter can be used to recover a specific job entry.

JobType String
[ProcessJobId] Integer
AddJobRequestById Integer JobId Integer Adds a job request for the job given in JobId. Upon success the RequestId is returned otherwise -1. JobId is the Id of the Job as given in the available job list in the Control Center. The Job Id can be retrieved in the script with the function JobIdByJobName(). 
AddNumberOfCopies Void PrintId String Sets the number of copies to print in the printer settings of PrintId
NumOfCopies Integer
AddPrinter Void PrintId String Adds a printer to the printer settings of PrintId.
Printer String
AddPrintFileName Void PrintId String Sets the print filename for the printer settings of PrintId.
Filename String
AddPrintSetting Void PrintId String Sets all the printer settings for the given PrintId.
PrintFile String
Printer String
DontPrint Boolean
NumOfCopies Integer
PrintBanner Boolean
NoDateSubDir Boolean
ChangePrintFileName Void Source String Changes the name of an existing print file in the system database. Only the filename in the system database gets changed, not the actual file. Can be used when a filename gets changed by another process and the name in the system database should match the new name. Both Source and Destination are represented in full path\filename but are not case sensitive.
Destination String
ClearBatchFiles Void None Clears all the entries in the system tables for this run of this job.
ClearPrintFileNames Void None Clears the current list of print filenames in the print settings
ClearPrintSettings Void None Clears all the printer settings set locally inside the Job object.
ClearTaskValues Void None Clears all the Task values set for this job.
GetTVCustom String Key String Returns the value of the Custom Task value with the give key.
GetTVSwitch Void Switch String Returns the state of the given switch, True or False.
Kill Integer None Kills the current running job, whatever the state of that job is. Returned is the RequestId of the kill action. If the 'User' property has been filled in, that value will be used in the Control Center to show who killed the job.
RemovePrintFileName Void Filename String Remove the entry with the given filename from the system tables.
SendInput Void InputValue String Sends a message to a job that is waiting for an input request.
SendInterrupt Void Value Integer Sends an interrupt request to a job. An interrupt value must be entered as value. In a Report this value will be available in the system variable SI-REPORTRESULT.
SetDefaultDontPrint Void DontPrint Boolean Sets the DontPrint switch in the printer settings for the default printer. When set to True the printfile will not be printed, but just created as printfile.
SetDefaultNoDateSubDirectory Void NoDateSubDir Boolean Sets the NoDateSubDir switch in the printer settings for the default printer. When set to True no dated subdirectory will be created inside the prints directory, the FormId directory or the Backup directory.
SetDontPrint Void PrintId String Sets the DontPrint switch in the printer settings of PrintId. When set to True the printfile will not be printed, but just created as printfile.
DontPrint Boolean
SetNoDateSubdirectory Void PrintId String Sets the NoDataSubdirectory switch in the printer settings of PrintId. When set to True no dated subdirectory will be created inside the prints directory, the FormId directory or the Backup directory.
NoDateSubDir Boolean
SetPrintBanner Void PrintId String Sets the PrintBanner switch in the printer settings of PrintId. When set to true the default banner or the banner file set will be printed.
PrintBanner Boolean
SetTVCustom Void Key String Sets the Task value for the given Key for the use inside the report.
Value String
SetTVSwitch Void Switch String Sets the Task value Switch to either True or False. The value of the switch can be used and changed inside the report.
Value Boolean
Stop Integer None Stops the execution of the current job in a nicely fashion. I.e. it waits until a Commit() is executed inside the report before stopping the report. The returned value is the RequestId of the Stop action.
StopReport Integer JobId Integer Stops the execution of the job with the given JobId in a nicely fashion. I.e. it waits until a Commit() is executed inside the report before stopping the report.
WakeUp Integer None Sends a Wakeup signal to the current sleeping job. The returned value is the RequestId of the WakeUp action.
WakeUpParameter Integer Parameter Strings Sends a Wakeup signal to the current sleeping job and passes the Parameter to that job. The returned value is the RequestID of the Wakeup action.

Return to

Task Object

Contents

 Go to top