Validation: IMetabaseObjectDescriptor
Validation: Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptor
The Validation property determines the validation rule, on executing of which the task is performed.
The property is relevant if IScheduledTask.CreateChecker = ScheduledTaskCheckerType.Validation.
Executing the example requires:
Scheduled tasks container with the TASK_CONTAINER identifier that contains a task.
Time series database with the RUBRICATOR identifier containing validation rule with the VALIDATION identifier.
Add links to the Metabase, Fore system assemblies.
Sub UserProc;
Var
MB: IMetabase;
cont: IScheduledTasksContainer;
task: IScheduledTask;
TChecker: IScheduledTaskChecker;
ValidationChecker: IScheduledTaskValidationChecker;
Begin
MB := metabaseClass.Active;
cont := MB.ItemById("TASK_CONTAINER").Edit As IScheduledTasksContainer;
task := cont.Tasks.Item(0).Edit As IScheduledTask;
TChecker := task.CreateChecker(ScheduledTaskCheckerType.Validation);
ValidationChecker := TChecker As IScheduledTaskValidationChecker;
Debug.WriteLine("Task execution condition is set: ");
Select Case (TChecker.Type As Integer)
Case 0: Debug.WriteLine(" - Execute task if function is performed with result");
Case 1: Debug.WriteLine(" - Execute task if validation rule is performed with result");
End Select;
ValidationChecker.Validation := MB.ItemByIdNamespace("VALIDATION", MB.ItemById("RUBRICATOR").Key).Bind;
ValidationChecker.Condition := STValidationCheckerConditionType.Equal;
ValidationChecker.ExceptionCount := 0;
task.TaskChecker := TChecker;
(task As IMetabaseObject).Save;
End Sub UserProc;
After executing the example, task execution setup conditions are set:
The Perform the Task if Validation Rule is Executed with Result task execution condition is set.
Validation rule is selected.
Validation rule execution result is set.
The requirements and result of the Fore.NET Example execution match with those in the Fore Example. Connect the KeFore system assembly instead of the Fore system assembly.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.KeFore;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
cont: IScheduledTasksContainer;
task: IScheduledTask;
TChecker: IScheduledTaskChecker;
ValidationChecker: IScheduledTaskValidationChecker;
Begin
MB := Params.Metabase;
cont := MB.ItemById["TASK_CONTAINER"].Edit() As IScheduledTasksContainer;
task := cont.Tasks.Item[0].Edit() As IScheduledTask;
TChecker := task.CreateChecker(ScheduledTaskCheckerType.sctValidation);
ValidationChecker := TChecker As IScheduledTaskValidationChecker;
System.Diagnostics.Debug.WriteLine("Task execution condition is set: ");
Select Case (TChecker.Type As Integer)
Case 0: System.Diagnostics.Debug.WriteLine(" - Execute task if function is performed with result");
Case 1: System.Diagnostics.Debug.WriteLine(" - Execute task if validation rule is performed with result");
End Select;
ValidationChecker.Validation := MB.ItemByIdNamespace["VALIDATION", MB.ItemById["RUBRICATOR"].Key].Bind();
ValidationChecker.Condition := STValidationCheckerConditionType.scctEqual;
ValidationChecker.ExceptionCount := 0;
task.TaskChecker := TChecker;
(task As IMetabaseObject).Save();
End Sub;
See also: