Item(Index: Integer): IScheduledTaskResult;
Index is an index of the record in the task execution history.
The Item property returns a record in the task execution history, index of which is passed by the Index parameter.
Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINTER identifier.
Sub UserProc;
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("Successfully completed");
Else
Debug.WriteLine("Finished with error");
End If;
End For;
End Sub UserProc;
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: