IScheduledTaskModuleChecker.Module

Fore Syntax

Module: IMetabaseObjectDescriptor

Fore.NET Syntax

Module: Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptor

Description

The Module property determines the assembly, unit or form, running of which executes an operation.

Comments

The assembly, unit or form must contain functions with the Function <name> (<param>: IScheduledTask): Boolean signature.

The property is relevant if IScheduledTask.CreateChecker = ScheduledTaskCheckerType.Module.

Fore Example

Executing the example requires:

Add links to the Metabase, Fore system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    cont: IScheduledTasksContainer;
    task: IScheduledTask;
    TChecker: IScheduledTaskChecker;
    ModuleChecker: IScheduledTaskModuleChecker;
Begin
    MB := metabaseClass.Active;
    cont := MB.ItemById("TASK_CONTAINER").Edit As IScheduledTasksContainer;
    task := cont.Tasks.Item(0).Edit As IScheduledTask;
    TChecker := task.CreateChecker(ScheduledTaskCheckerType.Module);
    ModuleChecker := TChecker As IScheduledTaskModuleChecker;
    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;
    If TChecker.Check = False Then
        ModuleChecker.Module := MB.ItemById("CHECK").Bind;
        ModuleChecker.Macro := "CHECK_FUNCTION";
        ModuleChecker.ExpectedResult := True;
        Else
            Debug.WriteLine(TChecker.CheckMsg);
    End If;
    task.TaskChecker := TChecker;
    (task As IMetabaseObject).Save;
End Sub UserProc;

After executing the example, task execution setup conditions are set:

Fore.NET Example

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;
    ModuleChecker: IScheduledTaskModuleChecker;
Begin
    MB := Params.Metabase;
    cont := MB.ItemById["TASK_CONTAINER"].Edit() As IScheduledTasksContainer;
    task := cont.Tasks.Item[0].Edit() As IScheduledTask;
    TChecker := task.CreateChecker(ScheduledTaskCheckerType.sctModule);
    ModuleChecker := TChecker As IScheduledTaskModuleChecker;
    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;
    If TChecker.Check() = False Then
        ModuleChecker.Module := MB.ItemById["CHECK"].Bind();
        ModuleChecker.Macro := "CHECK_FUNCTION";
        ModuleChecker.ExpectedResult := True;
        Else
            System.Diagnostics.Debug.WriteLine(TChecker.CheckMsg);
    End If;
    task.TaskChecker := TChecker;
    (task As IMetabaseObject).Save();
End Sub;

See also:

IScheduledTaskModuleChecker