History of Task Executing of Scheduled Tasks Container

Executing the example requires that the repository contains a scheduled tasks container with the NewSTCont identifier.

Sub Main;

Var

MB: IMetabase;

Cont: IScheduledTasksContainer;

Tasks: IMetabaseObjectDescriptors;

Task: IScheduledTask;

Results: IScheduledTaskResults;

Result: IScheduledTaskResult;

i: Integer;

Begin

MB := MetabaseClass.Active;

Cont := MB.ItemById("NewSTCont").Bind As IScheduledTasksContainer;

Tasks := Cont.Tasks;

Task := Tasks.Item(0).Bind As IScheduledTask;

Results := Task.GetResults;

For i := 0 To Results.Count - 1 Do

Result := Results.Item(i);

Debug.Write(Result.StartDateTime.ToString + " | ");

Debug.Write(Result.FinishDateTime.ToString + " | ");

If Result.Succeeded Then

Debug.WriteLine("Finished successfully");

Else

Debug.WriteLine("Finished with error");

End If;

End For;

End Sub Main;

After executing the example the history of the executing of first task in the scheduled tasks container is displayed in the development environment console. Date and time of the start and completion of task execution and also the result of execution (Finished successfully/with error) are displayed.

See also:

Examples