IScheduledTaskResults.Count

Syntax

Count: Integer;

Description

The Count property returns the number of records in the task execution history.

Example

Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINTER 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("TASK_CONTAINTER").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:

IScheduledTaskResults