IScheduledTask.ResetResults

Fore Syntax

ResetResults;

Fore.NET Syntax

ResetResults();

Description

The ResetResults method clears task execution history and set it to the Ready state.

Comments

To get task execution history, use the IScheduledTask.GetResults method.

Fore Example

Executing the example requires that the repository has a scheduled tasks container with the SCHEDULEDTASKSCONTAINER identifier.

Add links to the Fore, Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Cont: IScheduledTasksContainer;
    Tasks: IMetabaseObjectDescriptors;
    Task: IScheduledTask;
    Results: IScheduledTaskResults;
    Result: IScheduledTaskResult;
    i: Integer;
Begin
    
// Get current repository
    MB := MetabaseClass.Active;
    
// Get a container of scheduled tasks
    Cont := MB.ItemById("SCHEDULEDTASKSCONTAINER").Bind As IScheduledTasksContainer;
    
// Get the first task
    Tasks := Cont.Tasks;
    Task := Tasks.Item(
0).Edit As IScheduledTask;
    
// Clear task execution history
    Task.ResetResults;
    
// Save changes
    (Task As IMetabaseObject).Save;
End Sub UserProc;

After executing the example, the first task execution history will be reset, the task will be set to the Ready state.

Fore.NET Example

The requirements and result of the Fore.NET Example execution match with those in the Fore Example.

Imports Prognoz.Platform.Interop.KeFore;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Cont: IScheduledTasksContainer;
    Tasks: IMetabaseObjectDescriptors;
    Task: IScheduledTask;
    Results: IScheduledTaskResults;
    Result: IScheduledTaskResult;
    i: Integer;
Begin
    
// Get current repository
    MB := Params.Metabase;
    
// Get a container of scheduled tasks
    Cont := MB.ItemById["SCHEDULEDTASKSCONTAINER"].Bind() As IScheduledTasksContainer;
    
// Get the first task
    Tasks := Cont.Tasks;
    Task := Tasks.Item[
0].Edit() As IScheduledTask;
    
// Clear task execution history
    Task.ResetResults();
    
// Save changes
    (Task As IMetabaseObject).Save();
End Sub;

See also:

IScheduledTask