IBProcessStarterFactory.Split

Syntax

Split: IBProcessSplitStarter;

Description

The Split method returns the object used to start several process instances with splitting by dimension.

Example

Executing the example requires that the repository contains a process with the PROCESS identifier. The process has one parameter.

Add links to the BPM, Collections, Dimensions, Metabase system assemblies. Add a link to the assembly that is required to work with processes.

Sub UserProc;
Var
    Mb: IMetabase;
    MObj: IMetabaseObjectDescriptor;
    Process: IBProcess;
    SplitStarter: IBProcessSplitStarter;
    Param: IBProcessParam;
    DInst: IDimInstance;
    Sel: IDimSelection;
    ParamValues: IBProcessParamValues;
    SplitParamIds: IStringList;
    Arr: IArrayList;
    v: Variant;
Begin
    Mb := MetabaseClass.Active;
    MObj := Mb.ItemById("PROCESS");
    Process := BProcessCollection.EditByKey(MObj.Key);
    // Start with splitting by dimension
    SplitStarter := Process.StarterFactory.Split;
    SplitStarter.Deadline := DateTime.AddDays(DateTime.Now, 2);
    SplitStarter.RoleSid := "PS-1-1"// Admin
    SplitStarter.CheckAllLevels := False;
    // Create selection for process parameter
    Param := Process.Params.Item(0);
    DInst := Param.Descriptor.Open(NullAs IDimInstance;
    Sel := DInst.CreateSelection;
    Sel.SelectElement(0False);
    Sel.SelectElement(1False);
    Sel.SelectElement(2False);
    // Set selection for parameter and specify parameter for splitting of process instances
    ParamValues := Process.Params.CreateDefaultValues;
    ParamValues.Item(0).Value := Sel;
    SplitParamIds := New StringList.Create;
    SplitParamIds.Add(Param.Id);
    SplitStarter.ParamValues.CopyFrom(ParamValues);
    SplitStarter.SplitParamIds := SplitParamIds.Clone;
    // Start process instance
    SplitStarter.Start;
    // View startup result
    Debug.WriteLine("Start Result = " + SplitStarter.StartResult.ToString);
    Debug.WriteLine("Instance Ids:");
    Debug.Indent;
    Arr := SplitStarter.StartedInstanceIds;
    For Each v In Arr Do
        Debug.WriteLine(v);
    End For;
    Debug.Unindent;
    Debug.WriteLine("Instance Guid's:");
    Debug.Indent;
    Arr := SplitStarter.StartedInstances;
    For Each v In Arr Do
        Debug.WriteLine((v As IBProcessInstance).Guid);
    End For;
    Debug.Unindent;
End Sub UserProc;

After executing the example the object that is used to start several process instances with splitting by selection is obtained. Startup settings and parameter selection are set, then new process instances are started. Information about process instances will be displayed in the development environment console.

See also:

IBProcessStarterFactory