Bookshelf Home | Contents | Index | Search | PDF |
Siebel Analytics Scheduler Guide > Using Siebel Analytics Scheduler > Working with Scheduler Job Scripts >
Script Object Methods and Events
Siebel Analytics Scheduler has the following script object methods and Events available.
- CreateArray Method
- DeregisterCancelCommand Method
- GetConfigurationValue Method
- GetTempFileName Method
- LaunchProcess Method
- RegisterCancelCommand Method
- ScheduleJobDaily Method
- ScheduleJobMonthlyDate Method
- ScheduleJobMonthlyDOW Method
- ScheduleJobNow Method
- ScheduleJobOnce Method
- ScheduleJobWeekly Method
- OnError Event
CreateArray Method
Syntax 1
Syntax 2
Set array = CreateArray ( size )
Syntax 3
Set array = CreateArray ( element0, element1, ..., elementn)
Arguments
Return Value
Usage
This method is provided only for JScript because local JScript Array objects cannot be passed directly to the Script methods. This method is called to create an array object and pass the array object to Script methods that accept an array as arguments.
The different syntax versions create arrays as follows:
- Syntax 1 creates an array of size 0 (zero).
- Syntax 2 creates an array with the specified size.
- Syntax 3 creates an array filled with the specified elements.
Example
var i;
var array1= CreateArray(2);
for (i = 0; i < array1.Size; i++)
{
array1(i) = i;
}
array1.Resize(4);
for (i = 2; i < array1.Size; i++)
{
array1(i) = i;
}
var array2 = CreateArray(0, 1, 2,3);
for (i = 0; i < array2.Size; i++)
{
if (array1(i) != array2(i))
break;
}DeregisterCancelCommand Method
Deregisters a previously registered cancel method.
Syntax
Usage
Call this method to deregister the most recently registered cancel method after a long operation has completed successfully. You do not need to call this method if the script was canceled.
GetConfigurationValue Method
Returns the value in Siebel Analytics Scheduler configuration relative to the Scheduler's root registry entry.
Syntax
value = GetConfigurationValue(configKey [, subkeyPath])
Arguments
Return Value
Usage
GetConfigurationValue() returns the string value for a registry setting relative to Siebel Analytics Scheduler. The
configKey
andsubkeyPath
strings must be identical to those in the registry.GetTempFileName Method
Returns a temporary file name.
Syntax
Return Value
Usage
GetTempFileName() does not create a file. It only provides a temporary file name that can be used to create a file. Files created in job scripts are not deleted automatically when the script terminates.
LaunchProcess Method
Executes a command line in a new process.
Syntax
exitcode = LaunchProcess ( commandLine [, wait, terminateOnCancel] )
Arguments
Return Value
Usage
Call this method to execute a command line in a new process. If
wait
is set to True, this method returns the exit code returned by the process.RegisterCancelCommand Method
Registers a method to be called when the script is canceled.
Syntax
RegisterCancelCommand source, methodName [, arguments]...
Arguments
Usage
Occasionally, an object's method takes a long time to complete. If the job is canceled before the call returns, the script engine still must wait until the call returns. This could potentially take hours and tie up resources. This method solves the problem by registering a method that is asynchronously called by the script engine if the script gets canceled.
Cancel methods should be registered before calling the method that executes a long operation. When the method returns, the cancel method should be deregistered by calling DeregisterCancelCommand().
Good practice is to hide implementation details of a COM object from the caller, having the COM object itself handle all registration and deregistration of cancel commands. Pass an instance of the Script object to the COM object, then call the RegisterCancelCommand() and DeregisterCancelCommand() methods because the Script object implements the IDispatch interface.
ScheduleJobDaily Method
Schedules a new job with a Daily trigger.
Syntax
ScheduleJobDaily name, description, scriptType, script, startDate, startTime, endTime, minutesInterval, daysInterval [, parameters, flags, maxRunTimeMS, maxConcurrentInstances, endDate]
Arguments
Optional. A long value that specifies the flags associated with the job. For valid settings, see JobFlagsEnum Constants. The default is nqJobNoFlags.ScheduleJobMonthlyDate Method
Schedules a new job with a Monthly by Date trigger.
Syntax
ScheduleJobMonthlyDate name, description, scriptType, script, startDate, startTime, endTime, minutesInterval, whichDays, whichMonths [, parameters, flags, maxRunTimeMS, maxConcurrentInstances, endDate]
Arguments
An long value that specifies the days of the month the job runs. For valid settings, see DayEnum Constants. An integer value that specifies the months the job runs. For valid settings, see MonthEnum Constants. Optional. A long value that specifies the flags associated with the job. For valid settings, see JobFlagsEnum Constants. The default is nqJobNoFlags.ScheduleJobMonthlyDOW Method
Schedules a new job with a monthly by day of the week (DOW) trigger.
Syntax
ScheduleJobMonthlyDOW name, description, scriptType, script, startDate, startTime, endTime, minutesInterval, whichOccurrences, whichDays, whichMonths [, parameters, flags, maxRunTimeMS, maxConcurrentInstances, endDate]
Arguments
An integer value that specifies the occurrences of days of week the job runs. For valid settings, see DayEnum Constants. An integer value that specifies the days of week the job runs. For valid settings, see DayOfWeekEnum Constants. An integer value that specifies the months the job runs. For valid settings, see MonthEnum Constants. Optional. A long value that specifies the flags associated with the job. For valid settings, see JobFlagsEnum Constants. The default is nqJobNoFlags.ScheduleJobNow Method
Schedules a new job with a Run Now trigger.
Syntax
ScheduleJobNow name, description, scriptType, script [, parameters, flags, maxRunTimeMS]
Arguments
Optional. A long value that specifies the flags associated with the job. For valid settings, see JobFlagsEnum Constants. The default is nqJobNoFlags.ScheduleJobOnce Method
Schedules a new job with a Run Once trigger.
Syntax
ScheduleJobOnce name, description, scriptType, script, startDate, startTime [, parameters, flags, maxRunTimeMS]
Arguments
Optional. A long value that specifies the flags associated with the job. For valid settings, see JobFlagsEnum Constants. The default is nqJobNoFlag.ScheduleJobWeekly Method
Schedules a new job with a Weekly trigger.
Syntax
ScheduleJobWeekly name, description, scriptType, script, startDate, startTime, endTime, minutesInterval, weeksInterval, whichDays [, parameters, flags, maxRunTimeMS, maxConcurrentInstances, endDate]
Argument
Optional. A long value that specifies the flags associated with the job. For valid settings, see JobFlagsEnum Constants. The default is nqJobNoFlags.OnError Event
Occurs when the script engine encounters a run-time error while executing the script. This is intended for cleanup purposes, but the creative use of try/catch blocks in JScript and proper Error Handling in VBScript are often superior alternatives to using this event.
Syntax
Usage
The script engine calls this procedure when it encounters a run-time error while executing the script. Define this procedure in your script if you want to perform some cleanup activities before the script terminates, such as deleting temporary files and releasing resources.
Examples
Public Sub OnError()
LogFile.WriteLine "Encountered a runtime error in the script."
LogFile.Close
End Subfunction OnError()
{
LogFile.WriteLine("Encountered a runtime error in the
script.");
LogFile.Close();
}
Bookshelf Home | Contents | Index | Search | PDF |
Siebel Analytics Scheduler Guide Published: 11 March 2004 |